This is a discussion on moveToInsertRow doesn't work when using prepared statements within the pgsql Interfaces jdbc forums, part of the PostgreSQL category; --> Hello, calling moveToInsertRow on a ResultSet returned by a prepared statement leads to a NullPointerException: Example code: PreparedStatement p ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hello, calling moveToInsertRow on a ResultSet returned by a prepared statement leads to a NullPointerException: Example code: PreparedStatement p = c.prepareStatement( "SELECT * FROM sampletable WHERE myid=?", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); p.setInt(1,1); ResultSet r = p.executeQuery(); r.moveToInsertRow(); Result: Exception in thread "main" java.lang.NullPointerException at org.postgresql.core.v3.SimpleQuery.toString(Simple Query.java:40) at org.postgresql.jdbc2.AbstractJdbc2ResultSet.parseQ uery(AbstractJdbc2ResultSet.java:1656) at org.postgresql.jdbc2.AbstractJdbc2ResultSet.isUpda teable(AbstractJdbc2ResultSet.java:1516) at org.postgresql.jdbc2.AbstractJdbc2ResultSet.checkU pdateable(AbstractJdbc2ResultSet.java:2427) at org.postgresql.jdbc2.AbstractJdbc2ResultSet.moveTo InsertRow(AbstractJdbc2ResultSet.java:868) Driver Version: 8.0.309 JDBC3 PostgreSQL Version: 7.4.6 Best regards Martin Keller ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@postgresql.org so that your message can get through to the mailing list cleanly |
| ||||
| Martin Keller wrote: > calling moveToInsertRow on a ResultSet returned by a prepared statement leads > to a NullPointerException: Thanks for the report, fixed in CVS. A workaround is to specify protocolVersion=2 in the connection URL, as the V2 protocol code is correct (it looks like that change wasn't made in both paths when I was originally writing this code) -O ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) |