Skip site navigation (1) Skip section navigation (2)

Jdbc : DateStyle problem

From: "Laurent LS(dot) Savary" <laurent(dot)savary(at)medial(dot)fr>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Jdbc : DateStyle problem
Date: 2007-09-07 08:05:31
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc

I have a weird problem with jdbc PostGreSql driver 3
(postgresql-8.2-505.jdbc3.jar) and the DateStyle parameter on a

If I set the following value by psql (ALTER DATABASE "myDatabase" SET
DateStyle =ISO,European), the style of date is correctly modified on the
database, even if i reconnect pgAdmin by example.
The request "show DateStyle" gives me a correct result : ISO, DMY

But, if i launch the same request by the jdbc driver (I work with
Eclipse and Sql Explorer plugins), i obtain the following result :
Then, if i run a request, by jdbc, like : select * from table where
table.datefield = '15/01/2007' i have no result because postgresql wants
a MDY (01/15/2007) date. The same request, launched by psql, gives me
correct results.

The only way that i find is to run firstly (SET DATESTYLE TO
ISO,European;) on my jdbc session and then "show DateStyle" gives me :
But, if i close my jdbc session, i lost my datestyle and "show
datestyle" returns ISO,DMY.
It's normal because the modification is set on the session only.
An another workaround is to set the DateStyle on the postgresql.conf but
all databases are impacted... Not really good.

But,why the modification of the datestyle, set by psql (alter
database....), on my database is not effective on a jdbc session?

Thanks in advance,


Laurent Savary
Lyon - France


pgsql-jdbc by date

Next:From: Simon RiggsDate: 2007-09-07 09:17:20
Subject: Re: Caching driver on pgFoundry?
Previous:From: Paul van den BogaardDate: 2007-09-06 12:17:54
Subject: Re: Caching driver on pgFoundry?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group