Bug #622: jdbc driver exception: failed to get datetime field from a table

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #622: jdbc driver exception: failed to get datetime field from a table
Date: 2002-03-18 17:18:09
Message-ID: 20020318171809.CBAC8479251@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Zhou Hui Qing (suzi9999(at)yeah(dot)net) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
jdbc driver exception: failed to get datetime field from a table

Long Description
platform: SuSE 7.3 , Win2000 Server + cygwin !

When I using the example 'psql' (java example.psql jdbc:postgresql:mydb postgres postgres) to retrive data from the table 'test' (select * from test) , I got an exception:

java.lang.StringIndexOutOfBoundsException: String index out of range: 23
java.lang.StringIndexOutOfBoundsException: String index out of range: 23
at java.lang.String.charAt(String.java:455)
at org.postgresql.jdbc2.ResultSet.toTimestamp(ResultSet.java:1653)
at org.postgresql.jdbc2.ResultSet.getTimestamp(ResultSet.java:398)
at org.postgresql.jdbc2.ResultSet.getObject(ResultSet.java:768)
at example.psql.displayResult(psql.java:137)
at example.psql.processLine(psql.java:96)
at example.psql.<init>(psql.java:62)
at example.psql.main(psql.java:227)

Sample Code
java example.psql jdbc:postgresql:mydb postgres postgres

create table test(id serial primary key , name varchar(20) , dt datetime default now() );

insert into test (name) values ('my name');

select * from test;

--got an error!

No file was uploaded with this report

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2002-03-19 00:13:05 Re: psql's \r does not reset parenthesis depth counter
Previous Message Darcy Buskermolen 2002-03-18 16:54:41 Re: Bug #621: why postgreSQL stored databases in