pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Carsten Friedrich <carsten@dtecht.com.au>
To: pgsql-jdbc@postgresql.org
Subject: JDBC 7.4 to 8.1 regression problem
Date: Fri, 14 Jul 2006 12:01:28 +1000
Message-ID: <005a01c6a6e9$6b358c20$1500a8c0@carstenlaptop> (raw)

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






view thread (2+ messages)  latest in thread

Message-ID: <005a01c6a6e9$6b358c20$1500a8c0@carstenlaptop>
Permalink:  ../005a01c6a6e9$6b358c20$1500a8c0@carstenlaptop/
Also on:    postgresql.org/message-id/005a01c6a6e9$6b358c20$1500a8c0@carstenlaptop

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: carsten@dtecht.com.au
  Subject: Re: JDBC 7.4 to 8.1 regression problem
  In-Reply-To: <005a01c6a6e9$6b358c20$1500a8c0@carstenlaptop>
  References: <005a01c6a6e9$6b358c20$1500a8c0@carstenlaptop>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox