| From: | dmp <danap(at)ttc-cmc(dot)net> |
|---|---|
| To: | Vinayak <vinpokale(at)gmail(dot)com>, PostgreSQL JDBC <pgsql-jdbc(at)postgresql(dot)org> |
| Subject: | Re: Problem with DATE |
| Date: | 2015-01-19 17:22:57 |
| Message-ID: | 54BD3D71.2070403@ttc-cmc.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Mortier | 2015-01-19 20:36:24 | problem with pgjdbc prepared statements and new jsonb exists operator (?) |
| Previous Message | Vinayak | 2015-01-19 13:00:13 | Re: Problem with DATE |