Europe/Busingen? Check TimeZone on Linux host

We in Switzerland have the TimeZone Europe/Zurich. If you are using Java to connect to an Oracle DB, and the DB responds with an exception ORA-01882: timezone region not found it is most likely, that the connection problem is located on the linux host, in that the Java application runs. In my case it was rhel.

With an tzdata enhancement update RedHat delivers also the timezone Europe/Busingen. Java thinks that the default timezone is Busingen instead of Zurich. Check with a simple java program.

import java.util.TimeZone;
public class Tz {
    public static void main(String[] args) {

Compile and execute in /tmp folder

quang@cinhtau:/tmp> /opt/six/fo/java/jdk1.8.0_51/bin/javac Tz.java
quang@cinhtau:/tmp> /opt/six/fo/java/jdk1.8.0_51/bin/java Tz

Check against table on Oracle DB instance [sql] SELECT DISTINCT tzname FROM V$TIMEZONE_NAMES WHERE TZNAME LIKE ‘Europe/B%’; “TZNAME” “Europe/Bratislava” “Europe/Bucharest” “Europe/Brussels” “Europe/Belgrade” “Europe/Berlin” “Europe/Budapest” “Europe/Belfast” [/sql] There are several ways how Java retrieves the timezone:

  • Use the user.timezone system property, pass as param with -Duser.timezone="Europe/Zurich"
  • Use the TZ environment variable on the linux host ⇒ export TZ='Europe/Zurich', probably best in /etc/profile
  • Read the /etc/timezone file
  • Find the first file in /usr/share/zoneinfo/ that has the same contents.

/usr/share/zoneinfo/Europe/Busingen and /usr/share/zoneinfo/Europe/Zurich files have the same contents but Busingen is found first. Busingen is a german exclave in Switzerland, it has a separate timezone, because it doesn’t belong to Switzerland. Setting /etc/timezone

root@cinhtau:~# cat /etc/timezone

See alsoTime Zone Settings in the JRE. As alternative the datasource configuration via JDBC can be set:

<connection-property name="oracle.jdbc.timezoneAsRegion">false</connection-property>

Or via local Java application directly

Properties jdbc = new Properties();
        jdbc.setProperty(oracle.jdbc.OracleConnection.CONNECTION_PROPERTY_TIMEZONE_AS_REGION, "Europe/Zurich");