From: Martin Keller <martin.keller@unitedplanet.de>
To: pgsql-jdbc@postgresql.org
Subject: moveToInsertRow doesn't work when using prepared statements
Date: Thu, 27 Jan 2005 15:00:46 +0100
Message-ID: <200501271500.46617.martin.keller@unitedplanet.de> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: martin.keller@unitedplanet.de
Subject: Re: moveToInsertRow doesn't work when using prepared statements
In-Reply-To: <200501271500.46617.martin.keller@unitedplanet.de>
References: <200501271500.46617.martin.keller@unitedplanet.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox