Driver version or jar name
mssql-jdbc-PR684-jre8-02.jar
SQL Server version
Microsoft SQL Server 2016
Client operating system
windows 10
Java/JVM version
1.8.0
Table schema
My mssql instance has been installed with collatin SQL_Latin1_General_CP1_CI_AS
but my application's database has been created with Persian_100_BIN collation
Problem description
when I call this method:
DatabaseMetaData dbData = connection.getMetaData()
ikSet1 = dbData.getImportedKeys(null, ed.getSchemaName(), ed.getTableName())
i get this exception:
09:44:36.170 ERROR main o.m.i.e.EntityDbMeta Exception checking to see if foreign key exists for table EMAIL_MESSAGE
com.microsoft.sqlserver.jdbc.SQLServerException: Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Persian_100_BIN" in the equal to operation.
at com.microsoft.sqlserver.jdbc.SQLServerDatabaseMetaData.getResultSetForForeignKeyInformation(SQLServerDatabaseMetaData.java:1007) ~[mssql-jdbc-PR684-jre8-02.jar:?]
at com.microsoft.sqlserver.jdbc.SQLServerDatabaseMetaData.getImportedKeys(SQLServerDatabaseMetaData.java:878) ~[mssql-jdbc-PR684-jre8-02.jar:?]
at org.moqui.impl.entity.EntityDbMeta.foreignKeyExists(EntityDbMeta.groovy:504) [moqui-framework-2.1.1-rc2.jar:2.1.1-rc2]
Expected behavior and actual behavior
As you know getImportedKeys method is in jdbc driver and the query is creating in the driver
i think you should add " collate database_default" to end of the query ( according to this related issue 590 )
Repro code
DatabaseMetaData dbData = connection.getMetaData()
ikSet1 = dbData.getImportedKeys(null, ed.getSchemaName(), ed.getTableName())
Driver version or jar name
mssql-jdbc-PR684-jre8-02.jar
SQL Server version
Microsoft SQL Server 2016
Client operating system
windows 10
Java/JVM version
1.8.0
Table schema
My mssql instance has been installed with collatin SQL_Latin1_General_CP1_CI_AS
but my application's database has been created with Persian_100_BIN collation
Problem description
when I call this method:
DatabaseMetaData dbData = connection.getMetaData()
ikSet1 = dbData.getImportedKeys(null, ed.getSchemaName(), ed.getTableName())
i get this exception:
09:44:36.170 ERROR main o.m.i.e.EntityDbMeta Exception checking to see if foreign key exists for table EMAIL_MESSAGE
com.microsoft.sqlserver.jdbc.SQLServerException: Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Persian_100_BIN" in the equal to operation.
at com.microsoft.sqlserver.jdbc.SQLServerDatabaseMetaData.getResultSetForForeignKeyInformation(SQLServerDatabaseMetaData.java:1007) ~[mssql-jdbc-PR684-jre8-02.jar:?]
at com.microsoft.sqlserver.jdbc.SQLServerDatabaseMetaData.getImportedKeys(SQLServerDatabaseMetaData.java:878) ~[mssql-jdbc-PR684-jre8-02.jar:?]
at org.moqui.impl.entity.EntityDbMeta.foreignKeyExists(EntityDbMeta.groovy:504) [moqui-framework-2.1.1-rc2.jar:2.1.1-rc2]
Expected behavior and actual behavior
As you know getImportedKeys method is in jdbc driver and the query is creating in the driver
i think you should add " collate database_default" to end of the query ( according to this related issue 590 )
Repro code