X-Original-To: pgsql-jdbc-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id E5F359FB317 for ; Thu, 13 Jul 2006 23:08:17 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 05113-01 for ; Thu, 13 Jul 2006 23:08:09 -0300 (ADT) X-Greylist: delayed 00:06:38.144284 by SQLgrey- Received: from jay.exetel.com.au (jay.exetel.com.au [220.233.0.8]) by postgresql.org (Postfix) with ESMTP id 1FEBD9FAE4E for ; Thu, 13 Jul 2006 23:08:08 -0300 (ADT) Received: (qmail 23435 invoked by uid 507); 14 Jul 2006 12:01:27 +1000 Received: from 138.132.233.220.exetel.com.au (HELO mail.dtecht.com.au) (220.233.132.138) by jay.exetel.com.au with SMTP; 14 Jul 2006 12:01:27 +1000 Received: from localhost (unknown [127.0.0.1]) by mail.dtecht.com.au (Postfix) with ESMTP id BC04D494469 for ; Fri, 14 Jul 2006 02:01:27 +0000 (UTC) X-Virus-Scanned: amavisd-new at dtecht.com.au Received: from mail.dtecht.com.au ([127.0.0.1]) by localhost (milo.dtecht.com.au [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7ZSp97ClTEEC for ; Fri, 14 Jul 2006 12:01:27 +1000 (EST) Received: from carstenlaptop (carsten.dtecht.com.au [192.168.0.21]) by mail.dtecht.com.au (Postfix) with ESMTP id 17D35494215 for ; Fri, 14 Jul 2006 12:01:27 +1000 (EST) From: "Carsten Friedrich" To: Subject: JDBC 7.4 to 8.1 regression problem Date: Fri, 14 Jul 2006 12:01:28 +1000 Message-ID: <005a01c6a6e9$6b358c20$1500a8c0@carstenlaptop> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6626 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 Importance: Normal X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200607/60 X-Sequence-Number: 15486 I just tried to switch from Postgres 7.4 to 8.1. Works fine as far as the server is concerned, as long as I use the JDBC 7.4 driver in my program. If I use the JDBC driver postgresql-8.1-407.jdbc3.jar I have the following problem: I use the following prepared statement: [...] final static String SQL= "SELECT " + [...] " WHERE " + [...] + " AND service_date <= ?" + " and service_date > date ? - interval '365 days'; " [...] This statement works fine with the 7.4 JDBC, but using statement.setDate(5, someDate); // where someDate is a valid java.sql.Date I get the following error message when executing the statement: ERROR: syntax error at or near "$5" The last "?" (before "- interval") is $5. Playing around a bit (leaving out the " date " bit) I noticed that JDBC seems to substitute the "?" by "2005-05-02 +1000". However, I don't know if this is a good or bad thing. Your help in this would be much appreciated. Thanks, Carsten