Derby Syntax Error Encountered Order
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow
Syntax Error Encountered Auto_increment
the company Business Learn more about hiring developers or posting ads with us Stack syntax error encountered foreign Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of
Syntax Error Encountered Identity
4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Apache Derby - Syntax error: Encountered “;” at line 8, column 2 up vote 2 down vote favorite syntax error in expression encountered Making a small modular process in Java. However when i call the SQL statements from my website the system comes back with the error: java.sql.SQLSyntaxErrorException: Syntax error: Encountered ";" at line 8, column 2. Below is the first few lines of the SQL file in question as well as the system im using for retrieving the data. SQL: CREATE TABLE "chat_logs" ( "logId" BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH java.sql.sqlsyntaxerrorexception: syntax error: encountered 1, INCREMENT BY 1), "logDate" INT DEFAULT NULL, "logUser" BLOB, "logMessage" BLOB, PRIMARY KEY ("logId") ); CREATE TABLE "configs" ( "configId" BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), "configType" BLOB, "configSettings" BLOB, PRIMARY KEY ("configId") ); ... Retrieval Script: InputStream in = new URL("http://db.*******.com/derby/version1.00.sql").openStream(); return org.apache.commons.io.IOUtils.toString(in); It does not make sense as to how a syntax error can be generated from a place where a semicolon is supposed to be. java sql syntax-error derby javadb share|improve this question asked Jan 26 at 0:35 Addramyr 131110 1 "It does not make sense as to how a syntax error can be generated from a place where a semicolon is supposed to be." - But it >>does<< make sense if the semicolon is not supposed to be there! –Stephen C Jan 26 at 0:55 Try to post the query statement –Abdelhak Jan 26 at 0:58 If i post the statement as it is in RazorSQL or SQuirreL SQL it works fine. –Addramyr Jan 26 at 1:00 Do i have to process each SQL statement individually? –Addramyr Jan 26 at 1:00 3 If your code is trying to submit that SQL (the CREATE statements) using JDBC, then there should be one statement per
CommunityOracle User Group CommunityTopliners CommunityOTN Speaker BureauJava CommunityError: You don't have JavaScript enabled. This tool uses JavaScript and much of it will not work correctly without it enabled. Please turn JavaScript back on and reload this page. Please enter a title. You can not post a blank message. Please type your message and try again. More discussions in Java - JDBC Archive All PlacesOracle CommunityArchived ForumsJava - JDBC Archive This discussion is archived 10 Replies Latest reply http://stackoverflow.com/questions/35005109/apache-derby-syntax-error-encountered-at-line-8-column-2 on May 28, 2009 9:42 AM by 843859 Derby - Syntax error, why? 843859 Jan 21, 2015 7:19 AM Hello, I'm stumped as to why this doesn't work (the commented part works fine) try { String connn = "jdbc:derby:test;create=true"; Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); Connection connect = DriverManager.getConnection( connn ); // Statement stat; // https://community.oracle.com/thread/1323689 stat = connect.createStatement(); // stat.executeUpdate( "CREATE TABLE City ( NAME VARCHAR(35) NOT NULL )" ); // // Statement st; // st = connect.createStatement(); // st.executeUpdate("INSERT INTO City( Name ) " + // "VALUES( 'Amsterdam' )" ); // // PreparedStatement statement = connect.prepareStatement("SELECT Name FROM City"); // ResultSet resultSet = statement.executeQuery(); // while (resultSet.next()) { // System.out.println( resultSet.getString("Name") ); // } Statement stat; stat = connect.createStatement(); stat.executeUpdate( "CREATE TABLE weerstations ( "+ "stationsnummer VARCHAR(5) NOT NULL, "+ "voortzetting VARCHAR(5),"+ "naam String NOT NULL, "+ "positie string NOT NULL, "+ "terreinhoogte DOUBLE(2, 1), "+ "karakteristiek string NOT NULL, "+ "grondsoort string NOT NULL, "+ "barometer DOUBLE(3, 1), "+ "windmeetmast INT(2)" ); } catch( Exception e ) { e.printStackTrace(); } finally{ System.exit( 1); }The error it throws isjava.sql.SQLSyntaxErrorException: Syntax error: Encountered "String" at line 1, column 110. at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source) at
not work on tables that are created with delimited identifier names.Agile Board ExportXMLWordPrintableJSON Details Type: Bug Status: Closed Priority: Major Resolution: Fixed Affects Version/s: 10.0.2.2 Fix Version/s: 10.1.3.1, 10.2.1.6 Component/s: SQL Labels: None Description COMPRESS_TABLE procedure forms SQL statement undeneath, so if the user does not pass https://issues.apache.org/jira/browse/DERBY-437 quoted names , it is not working with delimited table/schema names.. eg: create table "Order"(a int ) ; ij> call SYSCS_UTIL.SYSCS_COMPRESS_TABLE('APP' , 'Order' ,1) ; ERROR 38000: The exception 'SQL Exception: Syntax error: Encountered "Order" at line 1, column 17.' was thrown while evaluating an expression. ERROR 42X01: Syntax error: Encountered "Order" at line 1, column 17. With quoted names it works fine. ij> call SYSCS_UTIL.SYSCS_COMPRESS_TABLE('APP' , '"Order"' ,1) ; 0 rows inserted/updated/deleted syntax error If it is expected that user to pass quoted names for SYSCS_UTIL.SYSCS_COMPRESS_TABLE, then it is ok. But doc is not clear: COMPRESS_TABLE doc in the reference manual: TABLENAME An input argument of type VARCHAR(128) that specifies the table name of the table. The string must exactly match the case of the table name, and the argument of "Fred" will be passed to SQL as the delimited identifier 'Fred'. Passing a null will result in syntax error encountered an error. So either doc has to be fixed or code needs to be fixed to handle quoted names for compress table. I think the code has to fixed to be consistent with other system procedures. . i.e If you created a schema, table or column name as a non-delimited identifier, you must pass the name in all upper case. If you created a schema, table or column name as a delimited identifier, you must pass the name in the same case as it was created. For example: create table "Order"(a int ) ; call SYSCS_UTIL.SYSCS_COMPRESS_TABLE('APP' , 'Order' ,1) ; create table t1( a int ) call SYSCS_UTIL.SYSCS_COMPRESS_TABLE('APP' , 'T1' ,1) ; OptionsSort By NameSort By DateAscendingDescendingAttachments derby437.diff 09/Jul/05 09:55 8 kB Suresh Thalamati Activity Ascending order - Click to sort in descending order All Comments Work Log History Activity Transitions Hide Permalink Suresh Thalamati added a comment - 09/Jul/05 09:55 Currently for compress procedure to work incase of case-sensitive table name , schema names, they needs to be passed in quotes like ( call SYSCS_UTIL.SYSCS_COMPRESS_TABLE('APP' , '"Order"' ,1) . This behaviour is not consitent with other procedures and the docs. This patch makes compress procedure parameters for table names , schema name should be passed in the case-sensitive form if they are quoted identfiers and in up