简体   繁体   中英

How to add Oracle JVM arguments to Tomcat execution

I'm using an Oracle 11G version on my application, which is an Apache Tomcat server.

Some users have issues with some queries to the database when they use a specific time zone, like ETC/Universal for example. Oracle throws following exception:

ORA-01882: timezone region not found

I found a workaround for this problem. There is a specific argument that needs to be given to the JVM when it starts:

-Doracle.jdbc.timezoneAsRegion=false

I want to put this in the configuration of Tomcat. I need a Windows and a Linux solution. Where can I put this setting?

You can add the JVM arguments in the startup script of tomcat (usually catalina.bat or catalina.sh).

For Windows (catalina.bat)

set JAVA_OPTS="%JAVA_OPTS% -Doracle.jdbc.timezoneAsRegion=false"

for linux (catalina.sh)

JAVA_OPTS="$JAVA_OPTS -Doracle.jdbc.timezoneAsRegion=false"
export JAVA_OPTS

Also you can Update the file oracle/jdbc/defaultConnectionProperties.properties (ie inside your jar - ojdbc7.jar or classes12.jar ) in whatever version of the library you are using to contain the line below:

oracle.jdbc.timezoneAsRegion=false

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM