db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clemens Eisserer <linuxhi...@gmail.com>
Subject Calling updateRow() after insertRow() leads to "java.sql.SQLException: Invalid cursor state"
Date Thu, 25 Nov 2010 20:37:39 GMT
Hi,

I would like to convert a small JDBCRowsSet based application from
postgresql to apache derby, which depends on an Swing databinding
library. (SwingSet)

The library works well with PostgreSQL's and MySQL'd JDBC drivers,
however with Derby I get SQLExceptions stating:
> java.sql.SQLException: Invalid cursor state - no current row.

The problem seems to be calling updateRow() after insertRow() was
called, please see the testcase attached below.
Any idea where the problem lies, and what I can do to solve it?

Thank you in advance, Clemens

Table definition:
> CREATE TABLE testtable (ikey INTEGER PRIMARY KEY  NOT NULL GENERATED BY DEFAULT AS IDENTITY,
name VARCHAR(127))

JdbcRowSetImpl    rowset = new JdbcRowSetImpl(ssConnection.getConnection());
rowset.setType(ResultSet.TYPE_SCROLL_INSENSITIVE);
rowset.setConcurrency(ResultSet.CONCUR_UPDATABLE);
rowset.setCommand("SELECT * FROM testtable");
rowset.execute();

rowset.next();
rowset.updateString("name", "1");
rowset.updateString("short", "2");
rowset.insertRow();

rowset.last();
rowset.updateRow();

Mime
View raw message