2 messages in com.mysql.lists.javaFw: Error? Resultset never updatable ...| From | Sent On | Attachments |
|---|---|---|
| Consulting Inf. Profesional S. L. | 24 Oct 2002 08:41 | |
| Mark Matthews | 24 Oct 2002 12:30 |
| Subject: | Fw: Error? Resultset never updatable created from a prepared statement![]() |
|---|---|
| From: | Consulting Inf. Profesional S. L. (cip...@cip-sl.com) |
| Date: | 10/24/2002 08:41:07 AM |
| List: | com.mysql.lists.java |
----- Original Message ----- From: "Cesar Garcia" <cip...@cip-sl.com> To: <ja...@lists.mysql.com> Sent: Thursday, October 24, 2002 5:02 PM Subject: Error? Resultset never updatable created from a prepared statement
Hi.
I have found that every resultset created from a prepared statement is not updatable. (mysql.jdbc 3.0.1). The same query "select * from atable" used in a statement and in a prepared statement (with or without parameters) produces that the resultset from the normal statement is updatable and from the prepared statement NOT. Is that correct or is it a bug?
String stsql="select * from atable ";
Statement st=connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
st.execute(stsql);
ResultSet rs=st.getResultSet();
rs.absolute(2);
rs.updateObject(2,"abcde"); // is ok, is updatable
rs.updateRow(); // is ok, is updateble
rs.close();
st.close();
PreparedStatement pst=connection.prepareStatement(stsql,
ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
rs=pst.executeQuery();
rs.absolute(5);
rs.updateObject(2,"abcde"); // Error, is not updatable ????
rs.updateRow(); // Error, is not updatable
The exception:
SQLException: Result Set not updatable. The query that generated this result set must select only one table, and must select all primary keys from that table. S ee the JDBC 2.1 API Specification, section 5.6 for more details. com.mysql.jdbc.NotUpdatable: Result Set not updatable. The query that generated this result set must select only one table, and must select all primary keys fro m that table. See the JDBC 2.1 API Specification, section 5.6 for more details. at com.mysql.jdbc.ResultSet.updateObject(ResultSet.java:3810)
Cesar Garcia.




