Re: Date format problem with INSERT statement.

From: "Guy Rouillier" <guyr(at)masergy(dot)com>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Date format problem with INSERT statement.
Date: 2006-04-13 15:46:56
Message-ID: CC1CF380F4D70844B01D45982E671B230137A882@mtxexch01.add0.masergy.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Olav Gjerde wrote:
> But when I do this in Java I get this error message
>
> SQLException: ERROR: date/time field value out of range: "13.04.06"
> SQLState: 22008
> VendorError: 0
>
> This is because it reads the date format as mm.dd.yy because when I
> insert with the value '12.04.06' it works perfect. I've changed the
> datestyle in my Database to European but it still doesn't work. Do
> the JDBC driver only insert dates in the US format?

Consider using PreparedStatement. Then you can store your date value as
a java.sql.Date variable, and set the column value to that.

--
Guy Rouillier

Browse pgsql-jdbc by date

  From Date Subject
Next Message Jeff Hubbach 2006-04-13 23:26:56 Possible regression: setNull() usage changed from 7.4 to 8.0 and up
Previous Message Leif B. Kristensen 2006-04-13 15:29:49 Re: browser shows garbage instead of UTF-8 characters