Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6765387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:42:21+00:00 2026-05-26T14:42:21+00:00

I get the following exception, java.sql.SQLSyntaxErrorException: Syntax error: Encountered 80 at line 1, column

  • 0

I get the following exception,

java.sql.SQLSyntaxErrorException: Syntax error: Encountered "80" at line 1, column 1100.

when I try to insert like the following! Any idea what this could mean??!

String insertString = "insert into queries (data_id, query, "
                + "query_name, query_file_name, status) values(" + currentDataID + ", '"
                + params[1] + "', '" + params[2] + "', '" 
                + params[3] + "', '" + params[4] + "')";
try {
     Statement stmt = dbconn.createStatement();
     stmt.execute(insertString, Statement.RETURN_GENERATED_KEYS);
     ResultSet rs = stmt.getGeneratedKeys(); 

     if (rs != null && rs.next()){     
           currentDataID = (int) rs.getLong(1); 
     } 
} catch (SQLException ex) {
}

Table definition,

CREATE TABLE queries (query_id INT not null primary key GENERATED "
                + "ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), data_id "
                + "INTEGER not null, foreign key (data_id) references data "
                + "(data_id), query LONG VARCHAR, query_name VARCHAR(150), "
                + "query_file_name VARCHAR(150),status VARCHAR(20))
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T14:42:22+00:00Added an answer on May 26, 2026 at 2:42 pm

    Try this approach with a prepared statement:

    String insert = "INSERT INTO queries (data_id, query, query_name," +
            " query_file_name, status) VALUES (?,?,?,?,?)";
    
    PreparedStatement stmt = dbconn.prepareStatement(insert, Statement.RETURN_GENERATED_KEYS);
    // Why do you set this if you want the DB to generate it?
    stmt.setInt(1, currentDataID); // or setLong() depending on data type
    stmt.setString(2, params[1]); // I assume params is a String[]
    stmt.setString(3, params[2]);
    stmt.setString(4, params[3]);
    stmt.setString(5, params[4]);
    stmt.execute();
    
    ResultSet rs = stmt.getGeneratedKeys();
    if (rs.next()) {
        // if it's an int, avoid the cast and use rs.getInt(1) instead
        currentDataID = (int) rs.getLong(1);
    }
    

    I don’t understand why you set the data_id while the later code expects the database to generate it… Your table definition would help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get the following error when I run a java program: Exception in thread
I encountered the following error when I was executing my application: java.sql.SQLException: No value
I get the following Exception running my app: java.net.SocketException: Permission denied (maybe missing INTERNET
I get the following error: Unhandled Exception: System.IO.IOException: The parameter is incorrect. at System.IO.__Error.WinIOError(Int32
For the attached code, I get the following compile time error : exception during
I get the following exception when trying to access any nodes of a parsed
I seemed to get the following exception when trying to deploy my application: Caused
The following WMI query throws an exception at serverProtocolsManagement.Get() when sqlHost is an invalid
When I execute the following query, I get an exception telling me that 'feedItemQuery'
When I run the following code, I get the exception below: ''# NOTE: ExcelApp

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.