liquibase.exception.DatabaseException: Error executing SQL INSERT INTO [dbo].[campus] ([created_by], [created_date], [description], [early_alert_coordinator_id], [id], [modified_by], [modified_date], [name], [object_status]) VALUES ('58BA5EE3-734E-4AE9-B9C5-943774B4DE41', '2012-05-17 19:00:00.0', 'net.sourceforge.jtds.jdbc.ClobImpl@6d13e8f3', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '901E104B-4DC7-43F5-A38E-581015E204E1', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '2013-03-19 13:27:33.533', 'Test Campus', '1'): Violation of PRIMARY KEY constraint 'PK_CAMPUS'. Cannot insert duplicate key in object 'dbo.campus'.: Caused By: Error executing SQL INSERT INTO [dbo].[campus] ([created_by], [created_date], [description], [early_alert_coordinator_id], [id], [modified_by], [modified_date], [name], [object_status]) VALUES ('58BA5EE3-734E-4AE9-B9C5-943774B4DE41', '2012-05-17 19:00:00.0', 'net.sourceforge.jtds.jdbc.ClobImpl@6d13e8f3', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '901E104B-4DC7-43F5-A38E-581015E204E1', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '2013-03-19 13:27:33.533', 'Test Campus', '1'): Violation of PRIMARY KEY constraint 'PK_CAMPUS'. Cannot insert duplicate key in object 'dbo.campus'.: Caused By: Violation of PRIMARY KEY constraint 'PK_CAMPUS'. Cannot insert duplicate key in object 'dbo.campus'.

Apereo Issues | Dan McCallum | 4 years ago
  1. 0

    As of d564427d2d83124296a1d06bc36615e78b942564 the data migration tool is generating {{insert}} refactoring commands but no preceding {{deletes}}. So you get errors like the following when actually running the changesets against a SSP database in a default state: {noformat} INFO 4/11/13 11:05 AM:liquibase: Successfully released change log lock Liquibase Update Failed: Error executing SQL INSERT INTO [dbo].[campus] ([created_by], [created_date], [description], [early_alert_coordinator_id], [id], [modified_by], [modified_date], [name], [object_status]) VALUES ('58BA5EE3-734E-4AE9-B9C5-943774B4DE41', '2012-05-17 19:00:00.0', 'net.sourceforge.jtds.jdbc.ClobImpl@6d13e8f3', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '901E104B-4DC7-43F5-A38E-581015E204E1', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '2013-03-19 13:27:33.533', 'Test Campus', '1'): Violation of PRIMARY KEY constraint 'PK_CAMPUS'. Cannot insert duplicate key in object 'dbo.campus'. SEVERE 4/11/13 11:05 AM:liquibase: Error executing SQL INSERT INTO [dbo].[campus] ([created_by], [created_date], [description], [early_alert_coordinator_id], [id], [modified_by], [modified_date], [name], [object_status]) VALUES ('58BA5EE3-734E-4AE9-B9C5-943774B4DE41', '2012-05-17 19:00:00.0', 'net.sourceforge.jtds.jdbc.ClobImpl@6d13e8f3', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '901E104B-4DC7-43F5-A38E-581015E204E1', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '2013-03-19 13:27:33.533', 'Test Campus', '1'): Violation of PRIMARY KEY constraint 'PK_CAMPUS'. Cannot insert duplicate key in object 'dbo.campus'. liquibase.exception.MigrationFailedException: Migration failed for change set mssql-1-2-src.xml::data migration tool - insert migrated data::data.migration.tool: Reason: liquibase.exception.DatabaseException: Error executing SQL INSERT INTO [dbo].[campus] ([created_by], [created_date], [description], [early_alert_coordinator_id], [id], [modified_by], [modified_date], [name], [object_status]) VALUES ('58BA5EE3-734E-4AE9-B9C5-943774B4DE41', '2012-05-17 19:00:00.0', 'net.sourceforge.jtds.jdbc.ClobImpl@6d13e8f3', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '901E104B-4DC7-43F5-A38E-581015E204E1', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '2013-03-19 13:27:33.533', 'Test Campus', '1'): Violation of PRIMARY KEY constraint 'PK_CAMPUS'. Cannot insert duplicate key in object 'dbo.campus'.: Caused By: Error executing SQL INSERT INTO [dbo].[campus] ([created_by], [created_date], [description], [early_alert_coordinator_id], [id], [modified_by], [modified_date], [name], [object_status]) VALUES ('58BA5EE3-734E-4AE9-B9C5-943774B4DE41', '2012-05-17 19:00:00.0', 'net.sourceforge.jtds.jdbc.ClobImpl@6d13e8f3', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '901E104B-4DC7-43F5-A38E-581015E204E1', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '2013-03-19 13:27:33.533', 'Test Campus', '1'): Violation of PRIMARY KEY constraint 'PK_CAMPUS'. Cannot insert duplicate key in object 'dbo.campus'.: Caused By: Violation of PRIMARY KEY constraint 'PK_CAMPUS'. Cannot insert duplicate key in object 'dbo.campus'. at liquibase.changelog.ChangeSet.execute(ChangeSet.java:347) at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:27) at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:58) at liquibase.Liquibase.update(Liquibase.java:113) at liquibase.integration.commandline.Main.doMigration(Main.java:779) at liquibase.integration.commandline.Main.main(Main.java:133) Caused by: liquibase.exception.DatabaseException: Error executing SQL INSERT INTO [dbo].[campus] ([created_by], [created_date], [description], [early_alert_coordinator_id], [id], [modified_by], [modified_date], [name], [object_status]) VALUES ('58BA5EE3-734E-4AE9-B9C5-943774B4DE41', '2012-05-17 19:00:00.0', 'net.sourceforge.jtds.jdbc.ClobImpl@6d13e8f3', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '901E104B-4DC7-43F5-A38E-581015E204E1', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '2013-03-19 13:27:33.533', 'Test Campus', '1'): Violation of PRIMARY KEY constraint 'PK_CAMPUS'. Cannot insert duplicate key in object 'dbo.campus'. at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:62) at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:104) at liquibase.database.AbstractDatabase.execute(AbstractDatabase.java:1075) at liquibase.database.AbstractDatabase.executeStatements(AbstractDatabase.java:1059) at liquibase.changelog.ChangeSet.execute(ChangeSet.java:317) ... 5 more Caused by: java.sql.SQLException: Violation of PRIMARY KEY constraint 'PK_CAMPUS'. Cannot insert duplicate key in object 'dbo.campus'. at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368) at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2820) at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2258) at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:632) at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:584) at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:546) at net.sourceforge.jtds.jdbc.JtdsStatement.executeImpl(JtdsStatement.java:723) at net.sourceforge.jtds.jdbc.JtdsStatement.execute(JtdsStatement.java:1160) at liquibase.executor.jvm.JdbcExecutor$1ExecuteStatementCallback.doInStatement(JdbcExecutor.java:92) at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55) ... 9 more {noformat}

    Apereo Issues | 4 years ago | Dan McCallum
    liquibase.exception.DatabaseException: Error executing SQL INSERT INTO [dbo].[campus] ([created_by], [created_date], [description], [early_alert_coordinator_id], [id], [modified_by], [modified_date], [name], [object_status]) VALUES ('58BA5EE3-734E-4AE9-B9C5-943774B4DE41', '2012-05-17 19:00:00.0', 'net.sourceforge.jtds.jdbc.ClobImpl@6d13e8f3', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '901E104B-4DC7-43F5-A38E-581015E204E1', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '2013-03-19 13:27:33.533', 'Test Campus', '1'): Violation of PRIMARY KEY constraint 'PK_CAMPUS'. Cannot insert duplicate key in object 'dbo.campus'.: Caused By: Error executing SQL INSERT INTO [dbo].[campus] ([created_by], [created_date], [description], [early_alert_coordinator_id], [id], [modified_by], [modified_date], [name], [object_status]) VALUES ('58BA5EE3-734E-4AE9-B9C5-943774B4DE41', '2012-05-17 19:00:00.0', 'net.sourceforge.jtds.jdbc.ClobImpl@6d13e8f3', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '901E104B-4DC7-43F5-A38E-581015E204E1', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '2013-03-19 13:27:33.533', 'Test Campus', '1'): Violation of PRIMARY KEY constraint 'PK_CAMPUS'. Cannot insert duplicate key in object 'dbo.campus'.: Caused By: Violation of PRIMARY KEY constraint 'PK_CAMPUS'. Cannot insert duplicate key in object 'dbo.campus'.
  2. 0

    As of d564427d2d83124296a1d06bc36615e78b942564 the data migration tool is generating {{insert}} refactoring commands but no preceding {{deletes}}. So you get errors like the following when actually running the changesets against a SSP database in a default state: {noformat} INFO 4/11/13 11:05 AM:liquibase: Successfully released change log lock Liquibase Update Failed: Error executing SQL INSERT INTO [dbo].[campus] ([created_by], [created_date], [description], [early_alert_coordinator_id], [id], [modified_by], [modified_date], [name], [object_status]) VALUES ('58BA5EE3-734E-4AE9-B9C5-943774B4DE41', '2012-05-17 19:00:00.0', 'net.sourceforge.jtds.jdbc.ClobImpl@6d13e8f3', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '901E104B-4DC7-43F5-A38E-581015E204E1', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '2013-03-19 13:27:33.533', 'Test Campus', '1'): Violation of PRIMARY KEY constraint 'PK_CAMPUS'. Cannot insert duplicate key in object 'dbo.campus'. SEVERE 4/11/13 11:05 AM:liquibase: Error executing SQL INSERT INTO [dbo].[campus] ([created_by], [created_date], [description], [early_alert_coordinator_id], [id], [modified_by], [modified_date], [name], [object_status]) VALUES ('58BA5EE3-734E-4AE9-B9C5-943774B4DE41', '2012-05-17 19:00:00.0', 'net.sourceforge.jtds.jdbc.ClobImpl@6d13e8f3', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '901E104B-4DC7-43F5-A38E-581015E204E1', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '2013-03-19 13:27:33.533', 'Test Campus', '1'): Violation of PRIMARY KEY constraint 'PK_CAMPUS'. Cannot insert duplicate key in object 'dbo.campus'. liquibase.exception.MigrationFailedException: Migration failed for change set mssql-1-2-src.xml::data migration tool - insert migrated data::data.migration.tool: Reason: liquibase.exception.DatabaseException: Error executing SQL INSERT INTO [dbo].[campus] ([created_by], [created_date], [description], [early_alert_coordinator_id], [id], [modified_by], [modified_date], [name], [object_status]) VALUES ('58BA5EE3-734E-4AE9-B9C5-943774B4DE41', '2012-05-17 19:00:00.0', 'net.sourceforge.jtds.jdbc.ClobImpl@6d13e8f3', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '901E104B-4DC7-43F5-A38E-581015E204E1', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '2013-03-19 13:27:33.533', 'Test Campus', '1'): Violation of PRIMARY KEY constraint 'PK_CAMPUS'. Cannot insert duplicate key in object 'dbo.campus'.: Caused By: Error executing SQL INSERT INTO [dbo].[campus] ([created_by], [created_date], [description], [early_alert_coordinator_id], [id], [modified_by], [modified_date], [name], [object_status]) VALUES ('58BA5EE3-734E-4AE9-B9C5-943774B4DE41', '2012-05-17 19:00:00.0', 'net.sourceforge.jtds.jdbc.ClobImpl@6d13e8f3', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '901E104B-4DC7-43F5-A38E-581015E204E1', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '2013-03-19 13:27:33.533', 'Test Campus', '1'): Violation of PRIMARY KEY constraint 'PK_CAMPUS'. Cannot insert duplicate key in object 'dbo.campus'.: Caused By: Violation of PRIMARY KEY constraint 'PK_CAMPUS'. Cannot insert duplicate key in object 'dbo.campus'. at liquibase.changelog.ChangeSet.execute(ChangeSet.java:347) at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:27) at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:58) at liquibase.Liquibase.update(Liquibase.java:113) at liquibase.integration.commandline.Main.doMigration(Main.java:779) at liquibase.integration.commandline.Main.main(Main.java:133) Caused by: liquibase.exception.DatabaseException: Error executing SQL INSERT INTO [dbo].[campus] ([created_by], [created_date], [description], [early_alert_coordinator_id], [id], [modified_by], [modified_date], [name], [object_status]) VALUES ('58BA5EE3-734E-4AE9-B9C5-943774B4DE41', '2012-05-17 19:00:00.0', 'net.sourceforge.jtds.jdbc.ClobImpl@6d13e8f3', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '901E104B-4DC7-43F5-A38E-581015E204E1', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '2013-03-19 13:27:33.533', 'Test Campus', '1'): Violation of PRIMARY KEY constraint 'PK_CAMPUS'. Cannot insert duplicate key in object 'dbo.campus'. at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:62) at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:104) at liquibase.database.AbstractDatabase.execute(AbstractDatabase.java:1075) at liquibase.database.AbstractDatabase.executeStatements(AbstractDatabase.java:1059) at liquibase.changelog.ChangeSet.execute(ChangeSet.java:317) ... 5 more Caused by: java.sql.SQLException: Violation of PRIMARY KEY constraint 'PK_CAMPUS'. Cannot insert duplicate key in object 'dbo.campus'. at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368) at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2820) at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2258) at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:632) at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:584) at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:546) at net.sourceforge.jtds.jdbc.JtdsStatement.executeImpl(JtdsStatement.java:723) at net.sourceforge.jtds.jdbc.JtdsStatement.execute(JtdsStatement.java:1160) at liquibase.executor.jvm.JdbcExecutor$1ExecuteStatementCallback.doInStatement(JdbcExecutor.java:92) at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55) ... 9 more {noformat}

    Apereo Issues | 4 years ago | Dan McCallum
    liquibase.exception.DatabaseException: Error executing SQL INSERT INTO [dbo].[campus] ([created_by], [created_date], [description], [early_alert_coordinator_id], [id], [modified_by], [modified_date], [name], [object_status]) VALUES ('58BA5EE3-734E-4AE9-B9C5-943774B4DE41', '2012-05-17 19:00:00.0', 'net.sourceforge.jtds.jdbc.ClobImpl@6d13e8f3', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '901E104B-4DC7-43F5-A38E-581015E204E1', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '2013-03-19 13:27:33.533', 'Test Campus', '1'): Violation of PRIMARY KEY constraint 'PK_CAMPUS'. Cannot insert duplicate key in object 'dbo.campus'.: Caused By: Error executing SQL INSERT INTO [dbo].[campus] ([created_by], [created_date], [description], [early_alert_coordinator_id], [id], [modified_by], [modified_date], [name], [object_status]) VALUES ('58BA5EE3-734E-4AE9-B9C5-943774B4DE41', '2012-05-17 19:00:00.0', 'net.sourceforge.jtds.jdbc.ClobImpl@6d13e8f3', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '901E104B-4DC7-43F5-A38E-581015E204E1', 'DA572870-5699-11E2-BE1E-406C8F22C3CE', '2013-03-19 13:27:33.533', 'Test Campus', '1'): Violation of PRIMARY KEY constraint 'PK_CAMPUS'. Cannot insert duplicate key in object 'dbo.campus'.: Caused By: Violation of PRIMARY KEY constraint 'PK_CAMPUS'. Cannot insert duplicate key in object 'dbo.campus'.
  3. 0

    The existing change sets are working fine in our current Liquibase version 3.1 When updating to Liquibase 3.2.3 or 3.3 we are getting exceptions. It is found that Liquibase adding Quotation marks to some items which turns a function such as NEWSEQUENTIALID() into strings (See photo). Specifically the changeset - {code} changes/changelog.v3_2_x.xml .. <changeSet author="dcraig" id="BASE-9393"> <createTable tableName="ENTITY_PRIVATE_WATCH"> <column name="id" type="${guid.type}" defaultValueComputed="${sql.newid}"/> properties.xml <property name="sql.newid" value="NEWSEQUENTIALID()" dbms="mssql"/> {code}. The exceptions are as follow: Error: java.sql.SQLException: Conversion failed when converting from a character string to uniqueidentifier. liquibase.exception.DatabaseException: java.sql.SQLException: Conversion failed when converting from a character string to uniqueidentifier. at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:316) at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55) at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:122) at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1227) at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1210) at liquibase.changelog.ChangeSet.execute(ChangeSet.java:550) at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:43) at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:73) at liquibase.Liquibase.update(Liquibase.java:200) at liquibase.integration.commandline.Main.doMigration(Main.java:1044) at liquibase.integration.commandline.Main.run(Main.java:175) at liquibase.integration.commandline.Main.main(Main.java:94) Caused by: java.sql.SQLException: Conversion failed when converting from a character string to uniqueidentifier. at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372) at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2988) at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2421) at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:671) at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:613) at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:572) at net.sourceforge.jtds.jdbc.JtdsStatement.executeImpl(JtdsStatement.java:809) at net.sourceforge.jtds.jdbc.JtdsStatement.execute(JtdsStatement.java:1282) at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:314) ... 11 more Also: SEVERE 2/04/15 9:10 AM: liquibase: database/changes/changelog.v3_2_x.xml::BASE-9393-DATA::dcraig: java.sql.SQLException: Conversion failed when converting from a character string to uniqueidentifier. liquibase.exception.MigrationFailedException: Migration failed for change set database/changes/changelog.v3_2_x.xml::BASE-9393-DATA::dcraig: Reason: liquibase.exception.DatabaseException: java.sql.SQLException: Conversion failed when converting from a character string to uniqueidentifier. at liquibase.changelog.ChangeSet.execute(ChangeSet.java:586) at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:43) at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:73) at liquibase.Liquibase.update(Liquibase.java:200) at liquibase.integration.commandline.Main.doMigration(Main.java:1044) at liquibase.integration.commandline.Main.run(Main.java:175) at liquibase.integration.commandline.Main.main(Main.java:94) Caused by: liquibase.exception.DatabaseException: java.sql.SQLException: Conversion failed when converting from a character string to uniqueidentifier. at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:316) at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55) at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:122) at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1227) at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1210) at liquibase.changelog.ChangeSet.execute(ChangeSet.java:550) ... 6 more Caused by: java.sql.SQLException: Conversion failed when converting from a character string to uniqueidentifier. at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372) at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2988) at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2421) at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:671) at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:613) at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:572) at net.sourceforge.jtds.jdbc.JtdsStatement.executeImpl(JtdsStatement.java:809) at net.sourceforge.jtds.jdbc.JtdsStatement.execute(JtdsStatement.java:1282) at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:314) ... 11 more

    JIRA | 2 years ago | Xiong Wen
    liquibase.exception.DatabaseException: java.sql.SQLException: Conversion failed when converting from a character string to uniqueidentifier.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Using the ntlmauth.dll with jtds to allow signon without a userid/password . In 3.3.5 this works fine. In 3.4.0 and 3.4.1 the update fails right away with an "alter user null" error. DEBUG 7/31/15 8:40 AM: liquibase: Connected to VAGRANT-WIN7\Administrator@jdbc:jtds:sqlserver://127.0.0.1:1433/SquirrelSiriusWare DEBUG 7/31/15 8:40 AM: liquibase: Setting auto commit to false from true DEBUG 7/31/15 8:40 AM: liquibase: Executing EXECUTE database command: ALTER USER null WITH DEFAULT_SCHEMA = [dbo] Unexpected error running Liquibase: Incorrect syntax near the keyword 'null'. [Failed SQL: ALTER USER null WITH DEFAULT_SCHEMA = [dbo]] SEVERE 7/31/15 8:40 AM: liquibase: Incorrect syntax near the keyword 'null'. [Failed SQL: ALTER USER null WITH DEFAULT_SCHEMA = [dbo]] liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Incorrect syntax near the keyword 'null'. [Failed SQL: ALTER USER null WITH DEFAULT_SCHEMA = [dbo ]] at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:143) at liquibase.integration.commandline.Main.doMigration(Main.java:915) at liquibase.integration.commandline.Main.run(Main.java:180) at liquibase.integration.commandline.Main.main(Main.java:99) Caused by: liquibase.exception.DatabaseException: Incorrect syntax near the keyword 'null'. [Failed SQL: ALTER USER null WITH DEFAULT_SCHEMA = [dbo]] at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:316) at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55) at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:122) at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:112) at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:123) ... 3 more Caused by: java.sql.SQLException: Incorrect syntax near the keyword 'null'. at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372) at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2988) at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2421) at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:671) at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:613) at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:572) at net.sourceforge.jtds.jdbc.JtdsStatement.executeImpl(JtdsStatement.java:809) at net.sourceforge.jtds.jdbc.JtdsStatement.execute(JtdsStatement.java:1282) at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:314) ... 7 more For more information, use the --logLevel flag

    JIRA | 1 year ago | Gregory Bruce
    liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Incorrect syntax near the keyword 'null'. [Failed SQL: ALTER USER null WITH DEFAULT_SCHEMA = [dbo ]]
  6. 0

    When trying to run liquibase from the commeand line with and the JDBC driver uses SSO (Using JTDS driver), this fails with a SQL syntax error. The command line used is: SET JDBC_DRIVER=net.sourceforge.jtds.jdbc.Driver SET JDBC_PATH=jdbc:jtds:sqlserver://%DB_SERVER%;Instance=%DB_INSTANCE%;SelectMethod=cursor;DatabaseName=%DB_NAME%;useNTLMv2=true;domain=MYDOMAIN; java -cp .\lib\* liquibase.integration.commandline.Main --classpath=%WAR_PATH% --driver=%JDBC_DRIVER% --url=%JDBC_PATH% --defaultSchemaName=dbo --changeLogFile=%LIQUIBASE_PATH% update NOTE: that we have to set the defaultSchemaName otherwise it tries to create a duplicate DATABASECHANGELOG. The problem exists in CommandLineUtils.java - this fails as there is no username defined, and the following code creates invalid SQL. {code:java} public static void initializeDatabase(String username, String defaultCatalogName, String defaultSchemaName, Database database) throws DatabaseException { if ((defaultCatalogName != null || defaultSchemaName != null) && !(database.getConnection() instanceof OfflineConnection)) { if (database instanceof OracleDatabase) { String schema = defaultCatalogName; if (schema == null) { schema = defaultSchemaName; } ExecutorService.getInstance().getExecutor(database).execute(new RawSqlStatement("ALTER SESSION SET CURRENT_SCHEMA="+schema)); } else if (database instanceof MSSQLDatabase && defaultSchemaName != null) { boolean sql2005OrLater = true; try { sql2005OrLater = database.getDatabaseMajorVersion() >= 9; } catch (DatabaseException e) { // Assume SQL Server 2005 or later } if (sql2005OrLater) { ExecutorService.getInstance().getExecutor(database).execute(new RawSqlStatement( "IF USER_NAME() <> N'dbo'\r\n" + "BEGIN\r\n" + " DECLARE @sql [nvarchar](MAX)\r\n" + " SELECT @sql = N'ALTER USER ' + QUOTENAME(USER_NAME()) + N' WITH DEFAULT_SCHEMA = " + database.escapeStringForDatabase(database.escapeObjectName(username, DatabaseObject.class)) + "'\r\n" + " EXEC sp_executesql @sql\r\n" + "END")); } } else if (database instanceof PostgresDatabase && defaultSchemaName != null) { ... {code} The exception generated is: DEBUG 2015/12/04 2:33 PM: liquibase: Setting auto commit to false from true DEBUG 2015/12/04 2:33 PM: liquibase: Executing EXECUTE database command: IF USER_NAME() <> N'dbo' BEGIN DECLARE @sql [nvarchar](MAX) SELECT @sql = N'ALTER USER ' + QUOTENAME(USER_NAME()) + N' WITH DEFAULT_SCHEMA = null' EXEC sp_executesql @sql END Unexpected error running Liquibase: Incorrect syntax near the keyword 'null'. [Failed SQL: IF USER_NAME() <> N'dbo' BEGIN DECLARE @sql [nvarchar](MAX) SELECT @sql = N'ALTER USER ' + QUOTENAME(USER_NAME()) + N' WITH DEFAULT_SCHEMA = null' EXEC sp_executesql @sql END] SEVERE 2015/12/04 2:33 PM: liquibase: Incorrect syntax near the keyword 'null'. [Failed SQL: IF USER_NAME() <> N'dbo' BEGIN DECLARE @sql [nvarchar](MAX) SELECT @sql = N'ALTER USER ' + QUOTENAME(USER_NAME()) + N' WITH DEFAULT_SCHEMA = null' EXEC sp_executesql @sql END] liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Incorrect syntax near the keyword 'null'. [Failed SQL: IF USER_NAME() <> N'dbo' BEGIN DECLARE @sql [nvarchar](MAX) SELECT @sql = N'ALTER USER ' + QUOTENAME(USER_NAME()) + N' WITH DEFAULT_SCHEMA = null' EXEC sp_executesql @sql END] at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:157) at liquibase.integration.commandline.Main.doMigration(Main.java:915) at liquibase.integration.commandline.Main.run(Main.java:180) at liquibase.integration.commandline.Main.main(Main.java:99) Caused by: liquibase.exception.DatabaseException: Incorrect syntax near the keyword 'null'. [Failed SQL: IF USER_NAME() <> N'dbo' BEGIN DECLARE @sql [nvarchar](MAX) SELECT @sql = N'ALTER USER ' + QUOTENAME(USER_NAME()) + N' WITH DEFAULT_SCHEMA = null' EXEC sp_executesql @sql END] at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:301) at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55) at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:107) at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:97) at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:130) ... 3 more Caused by: java.sql.SQLException: Incorrect syntax near the keyword 'null'. at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372) at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2988) at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2421) at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:677) at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:613) at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:572) at net.sourceforge.jtds.jdbc.JtdsStatement.executeImpl(JtdsStatement.java:809) at net.sourceforge.jtds.jdbc.JtdsStatement.execute(JtdsStatement.java:1282) at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:299) ... 7 more

    JIRA | 1 year ago | Gary Plante
    liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Incorrect syntax near the keyword 'null'. [Failed SQL: IF USER_NAME() <> N'dbo' BEGIN DECLARE @sql [nvarchar](MAX) SELECT @sql = N'ALTER USER ' + QUOTENAME(USER_NAME()) + N' WITH DEFAULT_SCHEMA = null' EXEC sp_executesql @sql END]

  1. abrazeneb 8 times, last 4 months ago
1 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.sql.SQLException

    Violation of PRIMARY KEY constraint 'PK_CAMPUS'. Cannot insert duplicate key in object 'dbo.campus'.

    at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic()
  2. jTDS
    JtdsStatement.execute
    1. net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368)
    2. net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2820)
    3. net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2258)
    4. net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:632)
    5. net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:584)
    6. net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:546)
    7. net.sourceforge.jtds.jdbc.JtdsStatement.executeImpl(JtdsStatement.java:723)
    8. net.sourceforge.jtds.jdbc.JtdsStatement.execute(JtdsStatement.java:1160)
    8 frames
  3. Liquibase Core
    Main.main
    1. liquibase.executor.jvm.JdbcExecutor$1ExecuteStatementCallback.doInStatement(JdbcExecutor.java:92)
    2. liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
    3. liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:104)
    4. liquibase.database.AbstractDatabase.execute(AbstractDatabase.java:1075)
    5. liquibase.database.AbstractDatabase.executeStatements(AbstractDatabase.java:1059)
    6. liquibase.changelog.ChangeSet.execute(ChangeSet.java:317)
    7. liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:27)
    8. liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:58)
    9. liquibase.Liquibase.update(Liquibase.java:113)
    10. liquibase.integration.commandline.Main.doMigration(Main.java:779)
    11. liquibase.integration.commandline.Main.main(Main.java:133)
    11 frames