moveToInsertRow doesn't work when using prepared statements

From: Martin Keller <martin(dot)keller(at)unitedplanet(dot)de>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: moveToInsertRow doesn't work when using prepared statements
Date: 2005-01-27 14:00:46
Message-ID: 200501271500.46617.martin.keller@unitedplanet.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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(SimpleQuery.java:40)
at
org.postgresql.jdbc2.AbstractJdbc2ResultSet.parseQuery(AbstractJdbc2ResultSet.java:1656)
at
org.postgresql.jdbc2.AbstractJdbc2ResultSet.isUpdateable(AbstractJdbc2ResultSet.java:1516)
at
org.postgresql.jdbc2.AbstractJdbc2ResultSet.checkUpdateable(AbstractJdbc2ResultSet.java:2427)
at
org.postgresql.jdbc2.AbstractJdbc2ResultSet.moveToInsertRow(AbstractJdbc2ResultSet.java:868)

Driver Version: 8.0.309 JDBC3
PostgreSQL Version: 7.4.6

Best regards
Martin Keller

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2005-01-27 21:00:41 Re: moveToInsertRow doesn't work when using prepared statements
Previous Message Kris Jurka 2005-01-27 11:33:45 Re: Patch for escaped escape char