Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-jdbc by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group