Is it possible to set the timezone to connect the H2 driver

Regarding older mail: Set database to default H2 timezone

Is it possible in the current build of H2 to set the timezone at the Connection / DB level, rather than relying on the JVM timezone that the driver loaded? I want the explicit Connection to our H2 DB to be UTC and not rely on a system property. I fully understand that the DB itself does not store timezone information, but it is a JDBC driver that does some interpretation of timezones when accessing data.

If it is not available, is it possible to add such a function (perhaps to the JDBC url string)?

+3


source to share


1 answer


I had the same problem and used a quick solution by putting them before loading the H2 driver.



System.setProperty("user.timezone", "UTC");
TimeZone.setDefault(null);

Class.forName("org.h2.Driver");

      

+2


source







All Articles