Re: Failure in timestamptz of JDBC of 7.2b4

From: Barry Lind <barry(at)xythos(dot)com>
To: Ryouichi Matsuda <r-matuda(at)sra(dot)co(dot)jp>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Failure in timestamptz of JDBC of 7.2b4
Date: 2002-01-08 18:19:27
Message-ID: 3C3B382F.2020604@xythos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

Ryouichi,

Thanks for the additional information. I will look at this when I get
some free time.

thanks,
--Barry

Ryouichi Matsuda wrote:

> Barry Lind wrote:
>
>
>>select 'now'::timestamp;
>>select 'now'::timestamptz;
>>select 'now'::timestamp with time zone;
>>
>>These all seem to work correctly for me.
>>
>
> When I executed SQL in <<example.psql>>, exception occurred.
> In an approach by a getTimestamp() method, exception does not occur.
>
> Statement st = db.createStatement();
> ResultSet rs = st.executeQuery("SELECT 'now'::timestamp");
> rs.next();
> Timestamp ts = rs.getTimestamp(1);
> System.out.println(ts);
>
>
> But, in an approach by a getObject() method, exception occurs.
>
> Statement st = db.createStatement();
> ResultSet rs = st.executeQuery("SELECT 'now'::timestamp");
> rs.next();
> Timestamp ts = (Timestamp)rs.getObject(1);
> System.out.println(ts);
>
> Because a displayResult() method of 'example/psql.java' uses
> getObject(), exception of 'No class found for timestamptz' occurs.
> The patch which I attached to a former mail corrects this error.
>
>
>
>>Then however I did try your last query:
>>
>>select 'now'::timestamp without time zone;
>>
>>and this does fail for me with the string index out of bounds exception.
>> However the patch you sent does not seem to fix this error. And I
>>really don't know what to do with this datatype, since jdbc does not
>>have a corresponding datatype that doesn't contain timezone information.
>>
>
> My patch does not correct this error. It is difficult for me to
> correct this error justly, but I try to think.
>
>
> In addition, I found an error of time type.
>
> Statement st = db.createStatement();
> ResultSet rs = st.executeQuery("SELECT 'now'::time");
> rs.next();
> Time t = rs.getTime(1);
> System.out.println(t);
>
> This becomes string index out of bounds exception.
>
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ulrich Neumann 2002-01-08 18:39:05 Antw: Re: (void *) with shmat
Previous Message Tom Lane 2002-01-08 17:19:32 Re: GETTIMEOFDAY_1ARG change

Browse pgsql-jdbc by date

  From Date Subject
Next Message Barry Lind 2002-01-08 18:51:12 Re: [HACKERS] JDBC: why is PGobject class instead of interface?
Previous Message Barry Lind 2002-01-08 17:49:47 Re: best way to use bitvarying?