Bug #794: JDBC 7.3 PreparedStatement.setNull(..) .setObject(.., null) throws exception - Mailing list pgsql-bugs

From pgsql-bugs@postgresql.org
Subject Bug #794: JDBC 7.3 PreparedStatement.setNull(..) .setObject(.., null) throws exception
Date
Msg-id 20021008210708.32C97475F5E@postgresql.org
Whole thread Raw
Responses Re: Bug #794: JDBC 7.3 PreparedStatement.setNull(..)
List pgsql-bugs
Olaf Liepelt (olafl@comrad.co.nz) reports a bug with a severity of 1
The lower the number the more severe it is.

Short Description
JDBC 7.3 PreparedStatement.setNull(..) .setObject(.., null) throws exception

Long Description
I'm using your JDBC driver 7.3 beta 1 (tested the developer one as well).
Folowing steps i've done:
 - Connecting to the datatbase
 - Set the connection into transaction mode
 - Created a PreparedStatement

Filled in the set column=? with setObject(column, Object);
when an Object is null the PreparedStatement.executeUpdate() throws an exception:
No value specified for parameter 3
        at org.postgresql.core.QueryExecutor.sendQuery(QueryExecutor.java:143)
        at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:65)
        at org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:468)
        at org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:320)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:48)
        at org.postgresql.jdbc1.AbstractJdbc1Statement.executeUpdate(AbstractJdbc1Statement.java:197)
        at comrad.database.sql.DatabaseAccess.doUpdate(DatabaseAccess.java:1497)
... my stuff

where parameter 3 was 'null'.

The same happens if I'm using the method setNull(column, type).


After the exception I'd like to rollback all changes. I get another exception when calling rollback():

java.sql.SQLException: ERROR:  Attribute 'nullqrollback' not found

        at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:126)
        at org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Co
nnection.java:449)
        at org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Co
nnection.java:432)
        at org.postgresql.jdbc1.AbstractJdbc1Connection.rollback(AbstractJdbc1C
onnection.java:967)
        at comrad.database.sql.DatabaseAccess.endTransaction(DatabaseAccess.jav
a:929)
... my stuff



Sample Code


No file was uploaded with this report

pgsql-bugs by date:

Previous
From: Christopher Swan
Date:
Subject: Bug in date/time input format
Next
From: Peter Eisentraut
Date:
Subject: Re: Bug in date/time input format