Problem with 8.1 driver
От | Michael Paesold |
---|---|
Тема | Problem with 8.1 driver |
Дата | |
Msg-id | 024401c5f9da$537c29c0$0f01a8c0@zaphod обсуждение исходный текст |
Ответы |
Re: Problem with 8.1 driver
|
Список | pgsql-jdbc |
Hi, I am running postgresql-8.1-404.jdbc3.jar against server version 7.4.7, which I want to eventually upgrade to 8.1. Right now I am testing our application with the 8.1 driver and found an issue with a prepared query. (Btw. I am using a regular connection URL without any special parameters set.) The offending code looks like this: String DELETE_QUERY = "DELETE FROM server_log WHERE level_value" + " <= ? AND event_time < NOW() - interval ?"; PreparedStatement stmt = con.prepareStatement(DELETE_QUERY); stmt.setInt(1, level.intValue()); stmt.setString(2, "1 day"); int deleted = stmt.executeUpdate(); Using the 7.4 driver this worked just fine. Now with the new driver I get: org.postgresql.util.PSQLException: ERROR: syntax error at or near "$2" at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1512) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1297) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:430) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:346) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:300) ... Server statement log shows: DELETE FROM server_log WHERE level_value <= $1 AND event_time < NOW() - interval $2 Is this a bug, or is the driver just not compatible with the server? Should not be so because both speak the V3 protocol. Thanks for your help. Best Regards, Michael Paesold
В списке pgsql-jdbc по дате отправления: