X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 50F24528E7 for ; Sat, 20 Aug 2005 13:14:46 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14644-08 for ; Sat, 20 Aug 2005 16:14:44 +0000 (GMT) Received: from eastrmmtao04.cox.net (eastrmmtao04.cox.net [68.230.240.35]) by svr1.postgresql.org (Postfix) with ESMTP id 8BBAB52AC1 for ; Sat, 20 Aug 2005 13:14:42 -0300 (ADT) Received: from lsuprasanth ([68.105.42.61]) by eastrmmtao04.cox.net (InterMail vM.6.01.04.00 201-2131-118-20041027) with SMTP id <20050820161442.DTNN9925.eastrmmtao04.cox.net@lsuprasanth>; Sat, 20 Aug 2005 12:14:42 -0400 From: "Prasanth" To: "Oliver Jowett" Cc: Subject: Re: Bad value for type date Date: Sat, 20 Aug 2005 11:16:37 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-Reply-To: <43072BE0.9000306@opencloud.com> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 required=5 tests=[none] X-Spam-Level: X-Archive-Number: 200508/155 X-Sequence-Number: 13724 Hi, Below if the code with result set to reproduce the problem. Thanks, -Prasanth. import java.sql.*; import java.util.Calendar; public class TestDate2 { public static void main(String[] args) throws Exception { Class.forName("org.postgresql.Driver"); Connection conn = DriverManager.getConnection(args[0]); Statement stmt = conn.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); try { stmt.executeUpdate("DROP TABLE testdate2"); } catch (SQLException e) {} stmt.executeUpdate("CREATE TABLE testdate2(id int4 primary key, d date)"); stmt.executeUpdate("INSERT INTO testdate2(id, d) VALUES (1,'10000/02/01')"); Calendar c = Calendar.getInstance(); c.set(Calendar.MONTH, 1); c.set(Calendar.DATE, 1); c.set(Calendar.YEAR, 10000); Date d = new Date(c.getTimeInMillis()); ResultSet rs = stmt.executeQuery("SELECT * FROM testdate2"); while (rs.next()) { rs.updateDate("d", d); rs.updateRow(); d = rs.getDate("d"); System.out.println("Got date: " + d); } rs.close(); stmt.close(); conn.close(); } } -----Original Message----- From: Oliver Jowett [mailto:oliver@opencloud.com] Sent: Saturday, August 20, 2005 8:11 AM To: dbadmin@nqadmin.com Cc: pgsql-jdbc@postgresql.org Subject: Re: [JDBC] Bad value for type date Prasanth wrote: > Below is a small program to test the JDBC date issue I have having. > > I am able to set the date "2/1/10000". But it fails to retrieve it. > > If it is invalid date then it should not even update the database right? I can't reproduce this; the attached testcase produces this against my 8.0 install: Inserting date: 10000-02-01 AD +1300 Got date: 10000-02-01 AD +1300 Got date: 10000-02-01 AD +1300 I get this using both the -310 driver and a build from CVS HEAD. You'll need to give us a compilable testcase that shows the problem to take this any further. The code you provided originally doesn't compile out-of-the-box, is missing schema information, and has a syntactically incorrect query.. It'd also help if you can reproduce your problem without involving a RowSet implementation. -O