Re: Jdbc : DateStyle problem

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: "Laurent LS(dot) Savary" <laurent(dot)savary(at)medial(dot)fr>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Jdbc : DateStyle problem
Date: 2007-09-07 12:28:46
Message-ID: 46E143FE.2070407@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Laurent LS. Savary wrote:

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

The JDBC driver resets DateStyle to a known value on each connection so
that it knows how to correctly format date values sent to the backend,
and correctly parse date values returned by the backend.

Really you should be using the JDBC methods that deal in terms of
java.sql.Date if you are manipulating dates (i.e.
PreparedStatement.setDate(), ResultSet.getDate() and so on). The driver
will then correctly handle the date value interpretation for you.

-O

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2007-09-07 12:33:41 Re: Caching driver on pgFoundry?
Previous Message Achilleas Mantzios 2007-09-07 12:07:58 Re: Jdbc : DateStyle problem