Re: Problem with DATE - Mailing list pgsql-jdbc

From Vinayak
Subject Re: Problem with DATE
Date
Msg-id 1421123270940-5833702.post@n5.nabble.com
Whole thread Raw
In response to Re: Problem with DATE  (Dave Cramer <pg@fastcrypt.com>)
Responses Re: Problem with DATE  (Vinayak <vinpokale@gmail.com>)
List pgsql-jdbc
Hi Dave,

The below example works fine using Oracle but in PostgreSQL it throws error
for date type so we need to typecast that argument.
Example:
ps = conn.prepareStatement("SELECT ?, ?, ?,?");
ps.setObject(1, new String("1.2"));
ps.setObject(2, new BigDecimal("1.2"));
ps.setObject(3, new String("2014-01-11 33:22:11"));
ps.setObject(4, Date.valueOf("2014-01-11"));

I don't know whether to add PGDATE class is appropriate or not but if the
above example works like Oracle in PostgreSQL then not necessary to change
java code during migration from Oracle to PostgreSQL.

Am I missing something?



-----
Regards,
Vinayak,

--
View this message in context: http://postgresql.nabble.com/Problem-with-DATE-tp5833008p5833702.html
Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com.


pgsql-jdbc by date:

Previous
From: Dave Cramer
Date:
Subject: Re: Problem with DATE
Next
From: Vinayak
Date:
Subject: Re: Problem with DATE