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

updatable resultsets -> SQLException: -1

From: Guido Fiala <guido(dot)fiala(at)dka-gmbh(dot)de>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: updatable resultsets -> SQLException: -1
Date: 2004-01-20 07:46:51
Message-ID: (view raw or whole thread)
Lists: pgsql-jdbc
hallo all,

i have a problem getting updatable resultsets working
(Postgres 7.3.4, current pg73jdbc3.jar)

basically i do:

try {
	Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
	Resultset rs=stmt.executeQuery("Select * from sometable;");
	rs.first();//in my example it exists
} catch ( SQLException e ) {

In that case i get an SQLException "no primary keys" whereas sometable definitely has primary key!!!

>java.sql.SQLException: No Primary Keys
>	at org.postgresql.jdbc2.AbstractJdbc2ResultSet.isUpdateable(
>	at org.postgresql.jdbc2.AbstractJdbc2ResultSet.updateRow(

i tracked this down and found that using:

Resultset rs=stmt.executeQuery("Select * from sometable for update of sometable;");

let's me indeed update the values in the table (even if the resultset is opened not-CONCUR_UPDATABLE) !!,
however there is still an "SQLException: -1" - whatever that means...

>java.sql.SQLException: -1
>	at org.postgresql.jdbc2.AbstractJdbc2ResultSet.updateRow(

Any hints?



pgsql-jdbc by date

Next:From: Kris JurkaDate: 2004-01-20 08:13:23
Subject: Re: updatable resultsets -> SQLException: -1
Previous:From: Frequency UnKnownDate: 2004-01-20 04:53:06
Subject: JDBC woes SOLVED!!!

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