Trouble with JDBC2 ResultSet.getDate()

From: Juhan-Peep Ernits <juhan(at)cc(dot)ioc(dot)ee>
To: pgsql-interfaces(at)postgresql(dot)org
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Trouble with JDBC2 ResultSet.getDate()
Date: 2001-03-20 09:25:55
Message-ID: Pine.GSO.4.21.0103201120540.27805-100000@suhkur.cc.ioc.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces pgsql-jdbc


System is Debian "woody"
java is IBM SDK1.3
Source is CVS from March 20, 2001.

Trouble is the following, that

org.postgresql.jdbc2.ResultSet.getDate(int)

Started to generate errors

java.lang.NumberFormatException: 15 14:25:17+02
at java.lang.Integer.parseInt(Integer.java:415)
at java.lang.Integer.parseInt(Integer.java:455)
at java.sql.Date.valueOf(Date.java:97)
at org.postgresql.jdbc2.ResultSet.getDate(ResultSet.java:427)
at org.postgresql.jdbc2.ResultSet.getDate(ResultSet.java:665)
...

when fetching dates from fields of timestamp
type. It seems that the fixes provided in CVS version 1.18 from Jan 24
23:41:04 2001 of ResultSet.java regarding getDate() method broke it for
our application. Now I went back to 1.17 and copied the

 SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
 
     try {
       return new java.sql.Date(df.parse(s).getTime());
     } catch (ParseException e) {
       throw new PSQLException("postgresql.res.baddate",new
Integer(e.getErrorOffset()),s);
     }

part to replace the new code:

     return java.sql.Date.valueOf(s);

and it works fine but I have not had time to debug this any further. May
be it would be nice to have that part of the old code included in the 7.1
release driver?

Regards,

Juhan Ernits

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message DI Hasenöhrl 2001-03-20 10:18:49 floatingpoint values and MsAccess
Previous Message Juhan-Peep Ernits 2001-03-20 09:12:08 Re: org.postgresql.Driver.java compile problem

Browse pgsql-jdbc by date

  From Date Subject
Next Message Gunnar R|nning 2001-03-20 11:59:21 Re: [JDBC] Re: PostgreSQL and PHP persistent connections
Previous Message Philip Warner 2001-03-20 06:09:29 Re: Re: Patch application