Received: from ns.sharemation.com (h-64-105-36-191.snvacaid.covad.net [64.105.36.191]) by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2KHuIN96588 for ; Tue, 20 Mar 2001 12:56:19 -0500 (EST) (envelope-from barry@xythos.com) Received: from xythos.com (IDENT:blind@frog.xythos.com [192.168.254.110]) by ns.sharemation.com (8.9.3/8.8.7) with ESMTP id JAA03073; Tue, 20 Mar 2001 09:43:02 -0800 Message-ID: <3AB799ED.7010706@xythos.com> Date: Tue, 20 Mar 2001 09:57:01 -0800 From: Barry Lind User-Agent: Mozilla/5.0 (X11; U; Linux 2.2.16-22smp i686; en-US; m18) Gecko/20010131 Netscape6/6.01 X-Accept-Language: en MIME-Version: 1.0 To: Juhan-Peep Ernits , pgsql-jdbc@postgresql.org Subject: Re: [INTERFACES] Trouble with JDBC2 ResultSet.getDate() References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Archive-Number: 200103/105 X-Sequence-Number: 321 Actually it was the changes in version 1.21 on 2/13 that broke this. The cvs log for that change includes the following comment: - Removed need for SimpleDateFormat in ResultSet.getDate() improving performance. My guess is the the code as written would work correctly for a 'date' column, but doesn't work for a 'timestamp' column. Is there a reason you are not using getTimestamp() to get the value of the timestamp column? thanks, --Barry Juhan-Peep Ernits wrote: > 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 > > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://www.postgresql.org/search.mpl