JDBC URL with ignorecase is not working for H2 database connection

Viewed 1808

I was trying to use h2 database in SQL mode. I was able to create a schema, all upper case, and create some tables under it. However, my application running on hibernate does not seem to work unless I match the schema name in all upper cases. I thought h2 could be configured using IGNROECASE=TRUE in the JDBC connection string. Am I missing something?

1 Answers

IGNORECASE setting is not related with names of database objects, it changes collation of CHARACTER VARYING columns to case insensitive in the weird way.

Unquoted identifiers in H2 with default settings and in many other DBMS are converted to upper case as required by the SQL Standard.

If you use MySQL or PostgreSQL compatibility modes, you usually need to specify DATABASE_TO_LOWER=TRUE, because these DBMS convert unquoted identifiers to lower case instead. You can find more detail about these compatibility modes there: https://h2database.com/html/features.html#compatibility

In some cases you may also need CASE_INSENSITIVE_IDENTIFIERS=TRUE.

Both these settings are available since H2 1.4.198. In older versions you can use DATABASE_TO_UPPER=FALSE instead; but don't use this setting in newer versions.

Related