# Error using generateChangeLog on existing derby database

**URL:** <https://forum.liquibase.org/t/error-using-generatechangelog-on-existing-derby-database/2179>\
**Category:** General Discussion\
**Created:** [January 9, 2013, 6:17pm UTC](https://forum.liquibase.org/t/error-using-generatechangelog-on-existing-derby-database/2179 "2013-01-09T18:17:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guest](https://avatars.discourse-cdn.com/v4/letter/g/8dc957/32.png) [@Guest](https://forum.liquibase.org/u/Guest)\
**Post date:** [January 9, 2013, 6:17pm UTC](https://forum.liquibase.org/t/error-using-generatechangelog-on-existing-derby-database/2179/1 "2013-01-09T18:17:00Z")

</div>

Hi&nbsp;

When using&nbsp;generateChangeLog &nbsp;to generate the changelog for an existing derby database, following error was seen.

generateChangeLog &nbsp;was used to generate changelog &nbsp;on various different preexisting databases, while it was successful to generate change log for some of them for others it failed with the following error

Logs:-

=========

Liquibase Home is not set.

Liquibase Home: /vobs/mac/liquibase

DEBUG 1/9/13 3:32 PM:liquibase: Unable to load/access Apache Derby driver class to check version

DEBUG 1/9/13 3:32 PM:liquibase: Unable to load/access Apache Derby driver class to check version

DEBUG 1/9/13 3:32 PM:liquibase: Connected to APP@jdbc:derby:/dv/scratch/gaur/gauravs/IBM/migrate/TestDb/vmgr.db

DEBUG 1/9/13 3:32 PM:liquibase: Reading tables for APP @ jdbc:derby:/dv/scratch/gaur/gauravs/IBM/migrate/TestDb/vmgr.db …

INFO 1/9/13 3:32 PM:liquibase: Reading tables for APP @ jdbc:derby:/dv/scratch/gaur/gauravs/IBM/migrate/TestDb/vmgr.db …

DEBUG 1/9/13 3:32 PM:liquibase: Reading views for APP @ jdbc:derby:/dv/scratch/gaur/gauravs/IBM/migrate/TestDb/vmgr.db …

INFO 1/9/13 3:32 PM:liquibase: Reading views for APP @ jdbc:derby:/dv/scratch/gaur/gauravs/IBM/migrate/TestDb/vmgr.db …

DEBUG 1/9/13 3:32 PM:liquibase: Reading foreign keys for APP @ jdbc:derby:/dv/scratch/gaur/gauravs/IBM/migrate/TestDb/vmgr.db …

INFO 1/9/13 3:32 PM:liquibase: Reading foreign keys for APP @ jdbc:derby:/dv/scratch/gaur/gauravs/IBM/migrate/TestDb/vmgr.db …

DEBUG 1/9/13 3:32 PM:liquibase: Reading primary keys for APP @ jdbc:derby:/dv/scratch/gaur/gauravs/IBM/migrate/TestDb/vmgr.db …

INFO 1/9/13 3:32 PM:liquibase: Reading primary keys for APP @ jdbc:derby:/dv/scratch/gaur/gauravs/IBM/migrate/TestDb/vmgr.db …

DEBUG 1/9/13 3:32 PM:liquibase: Reading columns for APP @ jdbc:derby:/dv/scratch/gaur/gauravs/IBM/migrate/TestDb/vmgr.db …

INFO 1/9/13 3:32 PM:liquibase: Reading columns for APP @ jdbc:derby:/dv/scratch/gaur/gauravs/IBM/migrate/TestDb/vmgr.db …

INFO 1/9/13 3:32 PM:liquibase: Shutting down derby connection: jdbc:derby:/dv/scratch/gaur/gauravs/IBM/migrate/TestDb/vmgr.db;shutdown=true

Liquibase Update Failed: Syntax error: Encountered “CONSTRAINTS” at line 1, column 8.

SEVERE 1/9/13 3:32 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.

&nbsp; &nbsp; &nbsp; &nbsp; at liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.createSnapshot(JdbcDatabaseSnapshotGenerator.java:251)

&nbsp; &nbsp; &nbsp; &nbsp; at liquibase.snapshot.DatabaseSnapshotGeneratorFactory.createSnapshot(DatabaseSnapshotGeneratorFactory.java:69)

&nbsp; &nbsp; &nbsp; &nbsp; at liquibase.diff.Diff.compare(Diff.java:63)

&nbsp; &nbsp; &nbsp; &nbsp; at liquibase.integration.commandline.CommandLineUtils.doGenerateChangeLog(CommandLineUtils.java:145)

&nbsp; &nbsp; &nbsp; &nbsp; at liquibase.integration.commandline.Main.doMigration(Main.java:760)

&nbsp; &nbsp; &nbsp; &nbsp; at liquibase.integration.commandline.Main.main(Main.java:134)

Caused by: java.sql.SQLSyntaxErrorException: Syntax error: Encountered “CONSTRAINTS” at line 1, column 8.

&nbsp; &nbsp; &nbsp; &nbsp; at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)

&nbsp; &nbsp; &nbsp; &nbsp; at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)

&nbsp; &nbsp; &nbsp; &nbsp; at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)

&nbsp; &nbsp; &nbsp; &nbsp; at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)

&nbsp; &nbsp; &nbsp; &nbsp; at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)

&nbsp; &nbsp; &nbsp; &nbsp; at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)

&nbsp; &nbsp; &nbsp; &nbsp; at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)

&nbsp; &nbsp; &nbsp; &nbsp; at org.apache.derby.impl.jdbc.EmbedStatement.executeQuery(Unknown Source)

&nbsp; &nbsp; &nbsp; &nbsp; at liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.isColumnAutoIncrement(JdbcDatabaseSnapshotGenerator.java:842)

&nbsp; &nbsp; &nbsp; &nbsp; at liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.readColumns(JdbcDatabaseSnapshotGenerator.java:369)

&nbsp; &nbsp; &nbsp; &nbsp; at liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.createSnapshot(JdbcDatabaseSnapshotGenerator.java:244)

&nbsp; &nbsp; &nbsp; &nbsp; … 5 more

Caused by: java.sql.SQLException: Syntax error: Encountered “CONSTRAINTS” at line 1, column 8.

&nbsp; &nbsp; &nbsp; &nbsp; at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)

&nbsp; &nbsp; &nbsp; &nbsp; at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)

&nbsp; &nbsp; &nbsp; &nbsp; … 16 more

Caused by: ERROR 42X01: Syntax error: Encountered “CONSTRAINTS” at line 1, column 8.

&nbsp; &nbsp; &nbsp; &nbsp; at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)

&nbsp; &nbsp; &nbsp; &nbsp; at org.apache.derby.impl.sql.compile.ParserImpl.parseStatement(Unknown Source)

&nbsp; &nbsp; &nbsp; &nbsp; at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)

&nbsp; &nbsp; &nbsp; &nbsp; at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)

&nbsp; &nbsp; &nbsp; &nbsp; at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)

&nbsp; &nbsp; &nbsp; &nbsp; … 10 more

&nbsp;

br

gaurav singh
