设置默认时区H2数据库 [英] Set default timezone H2 database

查看:593
本文介绍了设置默认时区H2数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何明确设置H2应该使用的时区?现在,它可以从基础操作系统获取要使用的时区.我假设存在一个额外的参数,我会将其添加到下面的连接字符串ala中.

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>

推荐答案

显然您的连接上没有参数,但是数据库将使用加载驱动程序的JVM的时区,因此您可以设置-Duser.timezone=UTC . 请注意,加载驱动程序后,您将无法更改时区.

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.

这篇关于设置默认时区H2数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆