3 messages in com.mysql.lists.javaResultSet moveToInsertRow fails - "Re...
FromSent OnAttachments
Paul Richards18 Apr 2004 10:18 
Mark Matthews18 Apr 2004 12:10 
Paul Richards18 Apr 2004 14:24 
Subject:ResultSet moveToInsertRow fails - "Result Set not updatable"
From:Paul Richards (Paul@Sun.COM)
Date:04/18/2004 10:18:18 AM
List:com.mysql.lists.java

Hi,

I am trying to execute the following piece of code using MySQL ('mysql-standard-4.0.18-sun-solaris2.9-sparc-64bit') and Connector/J ('mysql-connector-java-3.0.11-stable') but it throws an exception on the call to 'moveToInsertRow()'.

Statement stmt = con.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet uprs = stmt.executeQuery( "SELECT * FROM srrds");

uprs.moveToInsertRow(); uprs.updateString( "version", version ); uprs.insertRow(); int id = uprs.getInt( "id" );

The table was created like this:

create table srrds ( id integer not null unique auto_increment, version varchar(10) not null unique,

intro text, draft bool );

Here is a slightly fuller stack trace:

com.mysql.jdbc.NotUpdatable: Result Set not updatable.This result set must come from a statement that was created with a result set type of ResultSet.CONCUR_UPDATABLE, the query must select only one table, and must select all primary keys from that table. See the JDBC 2.1 API Specification, section 5.6 for more details. com.mysql.jdbc.UpdatableResultSet.moveToInsertRow(UpdatableResultSet.java:509) phoenix.shared.SRRD.createNewSRRD(Unknown Source)

I am about to go try this code on an Oracle database incase it is an issue with MySQL.