Re: Problem with DATE

From: Vinayak <vinpokale(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Problem with DATE
Date: 2015-01-13 04:27:50
Message-ID: 1421123270940-5833702.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Vinayak 2015-01-13 06:42:54 Re: Problem with DATE
Previous Message Dave Cramer 2015-01-12 11:35:07 Re: Problem with DATE