pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Laurent LS. Savary <laurent.savary@medial.fr>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Jdbc : DateStyle problem
Date: Sat, 08 Sep 2007 00:28:46 +1200
Message-ID: <46E143FE.2070407@opencloud.com> (raw)
In-Reply-To: <479CB622341AE44B81A6577D934714EE058F62@CETAUTOMATIX.medial.fr>
References: <479CB622341AE44B81A6577D934714EE058F62@CETAUTOMATIX.medial.fr>

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



view thread (3+ messages)

Message-ID: <46E143FE.2070407@opencloud.com>
Permalink:  ../46E143FE.2070407@opencloud.com/
Also on:    postgresql.org/message-id/46E143FE.2070407@opencloud.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: oliver@opencloud.com, laurent.savary@medial.fr
  Subject: Re: Jdbc : DateStyle problem
  In-Reply-To: <46E143FE.2070407@opencloud.com>
  References: <479CB622341AE44B81A6577D934714EE058F62@CETAUTOMATIX.medial.fr> <46E143FE.2070407@opencloud.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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