I am using liquibase to generate the changeLog.xml for a pre-existing derby database.
liquibase --logLevel=debug --driver=org.apache.derby.jdbc.EmbeddedDriver
--classpath=/xxx/derby.jar --changeLogFile=/xxx/TestDb/db.changelog2.xml
--url="jdbc:derby:/xxx/TestDb/yyyy.db" --username= --password= generateChangeLog
A sql syntax error ERROR 42X01: Syntax error: Encountered "CONSTRAINTS" at line 1, column 8
was reported by liquibase.
Can some one provide any pointers to resolve this issue?
Below is the error log:
Liquibase Home is not set. Liquibase Home: /xxx/liquibase DEBUG 1/9/13 5:40 PM:liquibase: Unable to load/access Apache Derby driver class to check version DEBUG 1/9/13 5:40 PM:liquibase: Unable to load/access Apache Derby driver class to check version DEBUG 1/9/13 5:40 PM:liquibase: Connected to APP@jdbc:derby:/xxx/TestDb/yyyy.db DEBUG 1/9/13 5:40 PM:liquibase: Reading tables for APP @ jdbc:derby:/xxx/TestDb/yyyy.db ... INFO 1/9/13 5:40 PM:liquibase: Reading tables for APP @ jdbc:derby:/xxx/TestDb/yyyy.db ... DEBUG 1/9/13 5:40 PM:liquibase: Reading views for APP @ jdbc:derby:/xxx/TestDb/yyyy.db ... INFO 1/9/13 5:40 PM:liquibase: Reading views for APP @ jdbc:derby:/xxx/TestDb/yyyy.db ... DEBUG 1/9/13 5:40 PM:liquibase: Reading foreign keys for APP @ jdbc:derby:/xxx/TestDb/yyyy.db ... INFO 1/9/13 5:40 PM:liquibase: Reading foreign keys for APP @ jdbc:derby:/xxx/TestDb/yyyy.db ... DEBUG 1/9/13 5:40 PM:liquibase: Reading primary keys for APP @ jdbc:derby:/xxx/TestDb/yyyy.db ... INFO 1/9/13 5:40 PM:liquibase: Reading primary keys for APP @ jdbc:derby:/xxx/TestDb/yyyy.db ... DEBUG 1/9/13 5:40 PM:liquibase: Reading columns for APP @ jdbc:derby:/xxx/TestDb/yyyy.db ... INFO 1/9/13 5:40 PM:liquibase: Reading columns for APP @ jdbc:derby:/xxx/TestDb/yyyy.db ... INFO 1/9/13 5:40 PM:liquibase: Shutting down derby connection: jdbc:derby:/xxx/TestDb/yyyy.db;shutdown=true Liquibase Update Failed: Syntax error: Encountered "CONSTRAINTS" at line 1, column 8. SEVERE 1/9/13 5:40 PM:liquibase: Syntax error: Encountered "CONSTRAINTS" at line 1, column 8. liquibase.exception.DatabaseException: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "CONSTRAINTS" at line 1, column 8. at liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.createSnapshot(JdbcDatabaseSnapshotGenerator.java:251) at liquibase.snapshot.DatabaseSnapshotGeneratorFactory.createSnapshot(DatabaseSnapshotGeneratorFactory.java:69) at liquibase.diff.Diff.compare(Diff.java:63) at liquibase.integration.commandline.CommandLineUtils.doGenerateChangeLog(CommandLineUtils.java:145) at liquibase.integration.commandline.Main.doMigration(Main.java:760) at liquibase.integration.commandline.Main.main(Main.java:134) Caused by: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "CONSTRAINTS" at line 1, column 8. 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 org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source) at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) at org.apache.derby.impl.jdbc.EmbedStatement.executeQuery(Unknown Source) at liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.isColumnAutoIncrement(JdbcDatabaseSnapshotGenerator.java:842) at liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.readColumns(JdbcDatabaseSnapshotGenerator.java:369) at liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.createSnapshot(JdbcDatabaseSnapshotGenerator.java:244) ... 5 more Caused by: java.sql.SQLException: Syntax error: Encountered "CONSTRAINTS" at line 1, column 8. at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source) ... 16 more Caused by: ERROR 42X01: Syntax error: Encountered "CONSTRAINTS" at line 1, column 8. at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) at org.apache.derby.impl.sql.compile.ParserImpl.parseStatement(Unknown Source) at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source) at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source) at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source) ... 10 more