JDBC 7.4 to 8.1 regression problem

From: "Carsten Friedrich" <carsten(at)dtecht(dot)com(dot)au>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: JDBC 7.4 to 8.1 regression problem
Date: 2006-07-14 02:01:28
Message-ID: 005a01c6a6e9$6b358c20$1500a8c0@carstenlaptop
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tom Lane 2006-07-14 16:15:01 Re: JDBC 7.4 to 8.1 regression problem
Previous Message Mark Lewis 2006-07-13 17:21:59 Re: password authentication failure