Re: Problem with DATE - Mailing list pgsql-jdbc

From dmp
Subject Re: Problem with DATE
Date
Msg-id 54BD3D71.2070403@ttc-cmc.net
Whole thread Raw
In response to Re: Problem with DATE  (Vinayak <vinpokale@gmail.com>)
Responses Re: Problem with DATE  (Vinayak <vinpokale@gmail.com>)
List pgsql-jdbc
Vinayak wrote:
> Hi,
> I tried to use setDate() instead of setObject() but still it gives the same
> error.
> Example:
> ps = conn.prepareStatement("SELECT ?");
> java.sql.Date sqlDate1 = new java.sql.Date(new java.util.Date().getTime());
> ps.setDate(6, sqlDate1);

That will not work has you said and is not the same code you demostrated.

Use the Oracle TO_DATE('db_date_content', 'YYYY-MM-dd') to collect
the correct formatted date string from the existing source database,

oracleDateString = SELECT TO_DATE(SELECT dateField, 'YYYY-MM-dd')

Use dateValue = java.sql.Date.valueOf(oracleDateString), and
             prepared_sqlStatement.setDate(i++, dateValue)
to set the date in PostgreSQL database.

danap.





pgsql-jdbc by date:

Previous
From: Vinayak
Date:
Subject: Re: Problem with DATE
Next
From: Peter Mortier
Date:
Subject: problem with pgjdbc prepared statements and new jsonb exists operator (?)