Received: from postgresql.org.org (webmail.postgresql.org [216.126.85.28]) by postgresql.org (8.11.3/8.11.1) with SMTP id f4BCulA49696 for ; Fri, 11 May 2001 08:56:47 -0400 (EDT) (envelope-from pgsql-interfaces-owner@postgresql.org) Received: from bastuba.partitur.se (bastuba.partitur.se [212.209.169.194]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f48GhbA52580; Tue, 8 May 2001 12:43:37 -0400 (EDT) (envelope-from girgen@partitur.se) Received: from elbas.partitur.se (elbas.partitur.se [212.209.169.222]) by bastuba.partitur.se (8.11.1/8.11.1) with ESMTP id f48GhaQ27235; Tue, 8 May 2001 18:43:36 +0200 (CEST) (envelope-from girgen@partitur.se) Received: from partitur.se (localhost [127.0.0.1]) by elbas.partitur.se (8.11.3/8.11.3) with ESMTP id f48GhZs37444; Tue, 8 May 2001 18:43:36 +0200 (CEST) (envelope-from girgen@partitur.se) Message-ID: <3AF82237.95BFE0BA@partitur.se> Date: Tue, 08 May 2001 18:43:35 +0200 From: Palle Girgensohn Organization: Partitur X-Mailer: Mozilla 4.76 [en] (X11; U; FreeBSD 4.3-RELEASE i386) X-Accept-Language: sv, en MIME-Version: 1.0 To: Bruce Momjian CC: Juhan-Peep Ernits , pgsql-interfaces@postgresql.org, pgsql-jdbc@postgresql.org Subject: Re: [JDBC] Re: Trouble with JDBC2 ResultSet.getDate() References: <200105081634.f48GYgn04910@candle.pha.pa.us> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200105/51 X-Sequence-Number: 1577 Well, I didn't see the patch, but my message (probably you just received) points to the fact that getDate shall work on a timestamp column, and some kind of patch shall be applied. I something like this: if s.length() == 10 return java.sql.Date.valueOf(s) else do the old 7.0.3 SimpleDateFormatter stuff. *or* try { return java.sql.Date.valueOf(s) } catch (SQLException e) { do the old SimpleDateFormatter stuff... } sort of... gotta go, or I'd have sent you a full patch. /Palle Bruce Momjian wrote: > > So, I am concluding that the timestamp patch should not be applied the > jdbc tree. > > > > > Hello! > > > > We solved the problem by patching the code of the jdbc driver (since the > > new code has ResultSet.getStatement() method and other useful > > enhancements) for some time, while we changed the code to use > > getTimestamp() method, since it is not a good idea to stick to patching > > the code of the jdbc driver. > > > > Of course it would be more comfortable if one could use getDate on a > > timestamp field, but it is not by default always available. > > > > In our case the new approach lead to more robust code (more typesafe), > > and in addition there were also a few other things that resolved when we > > started to use the new driver, so eventually we benefitted a lot of it. It > > depends how much code you have to rewrite but I'd suggest doing that. > > > > Juhan Ernits > > > > > > > > > > On Tue, 8 May 2001, Palle Girgensohn wrote: > > > > > I just got bitten by this too. I use type timestamp in the > > > database, and often need the latest timestamp, but want to > > > format it as a date. With 7.0.x, I just > > > > > > select ts from foo order by ts desc limit 1 > > > > > > and in java: d = res.getDate(1); > > > > > > but this fails everywhere in my code now :( > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 3: if posting/reading through Usenet, please send an appropriate > > subscribe-nomail command to majordomo@postgresql.org so that your > > message can get through to the mailing list cleanly > > > > -- > Bruce Momjian | http://candle.pha.pa.us > pgman@candle.pha.pa.us | (610) 853-3000 > + If your life is a hard drive, | 830 Blythe Avenue > + Christ can be your backup. | Drexel Hill, Pennsylvania 19026 -- Partitur Informationsteknik AB Wenner-Gren Center +46 8 566 280 02 113 46 Stockholm +46 70 785 86 02 Sweden girgen@partitur.se