pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
JDBC driver 9.2 sending arbitrary timezone
3+ messages / 2 participants
[nested] [flat]

* JDBC driver 9.2 sending arbitrary timezone
@ 2013-08-05 04:18 Alexandre Gattiker <agattiker@gmail.com>
  2013-08-05 06:16 ` Re: JDBC driver 9.2 sending arbitrary timezone Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: Alexandre Gattiker @ 2013-08-05 04:18 UTC (permalink / raw)
  To: pgsql-jdbc

Hello,

PostgreSQL jdbc jar 9.2-1003-jdbc4 is failing for me, while version
9.1-901-1.jdbc4 works fine. I was able to reproduce the issue by running
the jdbc driver's unit tests.

It appears the client is sending to the server the
timezone Europe/Busingen, although my timezone is set to Europe/Zurich.

runtest:
    [junit] Testsuite: org.postgresql.test.jdbc2.Jdbc2TestSuite
    [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
    [junit]
    [junit] Null Test:  Caused an ERROR
    [junit] null
    [junit] java.lang.reflect.InvocationTargetException
    [junit] Caused by: org.postgresql.util.PSQLException: FATAL: invalid
value for parameter "TimeZone": "Europe/Busingen"
    [junit] at
org.postgresql.core.v3.ConnectionFactoryImpl.readStartupMessages(ConnectionFactoryImpl.java:572)
    [junit] at
org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:177)
    [junit] at
org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:64)
    [junit] at
org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:136)
    [junit] at
org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:29)
    [junit] at
org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:21)
    [junit] at
org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:31)
    [junit] at
org.postgresql.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:24)
    [junit] at org.postgresql.Driver.makeConnection(Driver.java:406)
    [junit] at org.postgresql.Driver.connect(Driver.java:280)
    [junit] at java.sql.DriverManager.getConnection(DriverManager.java:571)
    [junit] at java.sql.DriverManager.getConnection(DriverManager.java:187)
    [junit] at org.postgresql.test.TestUtil.openDB(TestUtil.java:187)
    [junit] at org.postgresql.test.TestUtil.openDB(TestUtil.java:173)
    [junit] at
org.postgresql.test.jdbc2.Jdbc2TestSuite.suite(Jdbc2TestSuite.java:94)
    [junit] ... 25 more



Server: Postgres Plus; PostgreSQL 9.2.1 on x86_64-unknown-linux-gnu,
compiled by gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-52), 64-bit
CentOS release 6.4 (Final) Linux 2.6.32-358.11.1.el6.x86_64 #1 SMP Wed Jun
12 03:34:52 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

cat /etc/sysconfig/clock
ZONE="Europe/Zurich"

Regards,
Alexandre

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: JDBC driver 9.2 sending arbitrary timezone
  2013-08-05 04:18 JDBC driver 9.2 sending arbitrary timezone Alexandre Gattiker <agattiker@gmail.com>
@ 2013-08-05 06:16 ` Tom Lane <tgl@sss.pgh.pa.us>
  2013-08-06 20:55   ` Re: JDBC driver 9.2 sending arbitrary timezone Alexandre Gattiker <agattiker@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2013-08-05 06:16 UTC (permalink / raw)
  To: Alexandre Gattiker <agattiker@gmail.com>; +Cc: pgsql-jdbc

Alexandre Gattiker <agattiker@gmail.com> writes:
> PostgreSQL jdbc jar 9.2-1003-jdbc4 is failing for me, while version
> 9.1-901-1.jdbc4 works fine. I was able to reproduce the issue by running
> the jdbc driver's unit tests.
> It appears the client is sending to the server the
> timezone Europe/Busingen, although my timezone is set to Europe/Zurich.

According to the Olsen timezone database, Europe/Busingen is an alias for
Europe/Zurich.  So while it's an interesting question why the client side
is sending "Europe/Busingen" not "Europe/Zurich", you should get the same
result either way.  And it's not hard to imagine that there might be
logic somewhere inside Java that causes one to be substituted for the
other.

However, a look into the Olsen source files suggests that Europe/Busingen
was only added as a zone name in 2011.  When was your last server update?
I don't know whether EDB relies on the system tzdata package, so either
the postgres package or the tzdata package might be old ...

			regards, tom lane


-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: JDBC driver 9.2 sending arbitrary timezone
  2013-08-05 04:18 JDBC driver 9.2 sending arbitrary timezone Alexandre Gattiker <agattiker@gmail.com>
  2013-08-05 06:16 ` Re: JDBC driver 9.2 sending arbitrary timezone Tom Lane <tgl@sss.pgh.pa.us>
@ 2013-08-06 20:55   ` Alexandre Gattiker <agattiker@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Alexandre Gattiker @ 2013-08-06 20:55 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-jdbc

It appears that the timezone is set at CentOS installation by copying
 /usr/share/zoneinfo/Europe/Zurich to /etc/localtime. At runtime, when the
JDBC driver calls TimeZone.getDefault(), the JRE appears to search all
files in the CentOS timezone db (/usr/share/zoneinfo/) until it founds one
that is identical to the one in /etc/localtime. So the result is randomly
Europe/Zurich or Europe/Busingen, since both files are identical in
/usr/share/zoneinfo. If the timezone is set by doing "ln -sf
/usr/share/zoneinfo/Europe/Zurich /etc/localtime", the JRE finds the
intended one directly.

In any case, upgrading to the latest PostgreSQL version also solved it.

Thanks for your help,
Alexandre


On Mon, Aug 5, 2013 at 8:16 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Alexandre Gattiker <agattiker@gmail.com> writes:
> > PostgreSQL jdbc jar 9.2-1003-jdbc4 is failing for me, while version
> > 9.1-901-1.jdbc4 works fine. I was able to reproduce the issue by running
> > the jdbc driver's unit tests.
> > It appears the client is sending to the server the
> > timezone Europe/Busingen, although my timezone is set to Europe/Zurich.
>
> According to the Olsen timezone database, Europe/Busingen is an alias for
> Europe/Zurich.  So while it's an interesting question why the client side
> is sending "Europe/Busingen" not "Europe/Zurich", you should get the same
> result either way.  And it's not hard to imagine that there might be
> logic somewhere inside Java that causes one to be substituted for the
> other.
>
> However, a look into the Olsen source files suggests that Europe/Busingen
> was only added as a zone name in 2011.  When was your last server update?
> I don't know whether EDB relies on the system tzdata package, so either
> the postgres package or the tzdata package might be old ...
>
>                         regards, tom lane
>

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2013-08-06 20:55 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-08-05 04:18 JDBC driver 9.2 sending arbitrary timezone Alexandre Gattiker <agattiker@gmail.com>
2013-08-05 06:16 ` Tom Lane <tgl@sss.pgh.pa.us>
2013-08-06 20:55   ` Alexandre Gattiker <agattiker@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox