updatable resultsets -> SQLException: -1

Поиск
Список
Период
Сортировка
От Guido Fiala
Тема updatable resultsets -> SQLException: -1
Дата
Msg-id 200401200846.51519.guido.fiala@dka-gmbh.de
обсуждение исходный текст
Ответы Re: updatable resultsets -> SQLException: -1  (Kris Jurka <books@ejurka.com>)
Список 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
    rs.updateInt("some_int",4);
    rs.updateString("some_string","some_value");
    rs.updateRow();
} catch ( SQLException e ) {
    e.printStackTrace();
}

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(AbstractJdbc2ResultSet.java:1369)
>    at org.postgresql.jdbc2.AbstractJdbc2ResultSet.updateRow(AbstractJdbc2ResultSet.java:996)

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(AbstractJdbc2ResultSet.java:1082)
>...

Any hints?

Guido


В списке pgsql-jdbc по дате отправления:

Предыдущее
От: "Frequency UnKnown"
Дата:
Сообщение: JDBC woes SOLVED!!!
Следующее
От: Kris Jurka
Дата:
Сообщение: Re: updatable resultsets -> SQLException: -1