Re: Problem with DATE

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Vinayak <vinpokale(at)gmail(dot)com>
Cc: List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Problem with DATE
Date: 2015-01-16 10:41:05
Message-ID: CADK3HHLWkHswvzMLbBeQNYC_aEsZs6AzAES7sGceD29E-gOmEg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Vinayak,

Probably your easiest solution is to hack the driver .

The jar is easy to build with ant. Just change it so that it sends date
with date instead of unspecified. But be aware of the possibility of your
data being changed as per the comments in the code.

Dave Cramer

dave.cramer(at)credativ(dot)ca
http://www.credativ.ca

On 16 January 2015 at 00:35, Vinayak <vinpokale(at)gmail(dot)com> wrote:

> Hi Dave,
> Thank you for explanation.
>
> I understood that the behavior of date is different in PostgreSQL and Java.
> PostgreSQL DATE type return date part only.
> Java DATE return date and time with timezone.
> >I am guessing what you really want is to just take the date in your Oracle
> db, load it into java and store >it into postgresql without any
> transformation.
> >This would require a custom date type.
> I have created custom date type which return date and time in PostgreSQL.
> postgres=# select now()::date;
> now
> ---------------------------------
> 2015-01-16 10:51:41
> (1 row)
> but still PreparedStatement throws error for date parameter.
>
>
>
>
> -----
> Regards,
> Vinayak,
>
> --
> View this message in context:
> http://postgresql.nabble.com/Problem-with-DATE-tp5833008p5834215.html
> Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com.
>
>
> --
> Sent via pgsql-jdbc mailing list (pgsql-jdbc(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc
>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message dmp 2015-01-16 16:58:35 Re: Problem with DATE
Previous Message Vinayak 2015-01-16 05:35:06 Re: Problem with DATE