H2 runcript command makes all table names uppercase

I have a sql script (this is just a schema definition). The script is a modified version (getting rid of bad h2 characters is not like) mysql deadlock.

The script is executed and the schema is inserted into the h2 database, but the problem is that all the database names are in upper case ("xyz" is converted to "XYZ").

I need them to remain lowercase because my application is looking for lowercase letters (and all tables in mysql db have lowercase letters).

Why is this happening? How can I tell h2 not to do this? Is there a better way to insert a schema definition in h2?

This is the INT command that I run:

jdbc:h2:mem:~/test;INIT=runscript from '~/schema.sql' 

EDIT: Just tried this on the h2 console, same thing. So this is not some kind of INIT problem, this is the โ€œRUNSCRIPTโ€ command.

Tried this

 RUNSCRIPT FROM '~/schema.sql' 
+8
sql mysql h2 init
source share
2 answers

Problem detected. By default, for h2, this parameter is set to true DATABASE_TO_UPPER . Setting this parameter to false will save the data as expected. Therefore, in my INIT command (before it), I entered:

  jdbc:h2:mem:~/test;DATABASE_TO_UPPER=false;INIT=runscript from '~/schema.sql' 

Now tables are inserted in the correct register

+16
source share

Another option is to combine table and column names in double quotes to preserve the wrapper.

eg. create table "products" instead of create table products

+6
source share

All Articles