Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set default timezone H2 database

Tags:

h2

How can I explicitly set the time zone H2 should use? Now it gets the timezone to use from the underlying OS. I would assume there existed an extra parameter I would add to the connection string ala the one I have below.

db.url=jdbc:h2:mem:mybipper;MVCC=true;<timezone=UTC>
like image 762
Thomas Vervik Avatar asked Nov 01 '12 11:11

Thomas Vervik


People also ask

How do I change the timezone on my database?

Use the ALTER DATABASE SET TIME_ZONE command to change the time zone of a database. This command takes either a named region such as America/Los_Angeles or an absolute offset from UTC. This example sets the time zone to UTC: ALTER DATABASE SET TIME_ZONE = '+00:00';

Does H2 support CLOB?

sql. Clob ( java. io. Reader is also supported).


1 Answers

Apparently you don't have a parameter on the connection but the database will use the timezone of the JVM where the driver is loaded so you can set -Duser.timezone=UTC. Note that you can't change the timezone after the driver has been loaded.

like image 81
Cristian Vrabie Avatar answered Sep 19 '22 12:09

Cristian Vrabie