ResultSet.deleterow without primay key
I have a table which have not primary key or unique index,I want to get a row,after do some thing,then delete it:
pst = conn.prepareStatement("select * from mytable",
ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_UPDATABLE);
ResulstSet rs = pst.executeQuery();
while (rs.next()) {
String name = rs.getString("name");
resultSet.deleteRow();
}
}
run this program but throw exception:
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.at com.mysql.jdbc.UpdatableResultSet.deleteRow
How can I do it?
Thanks.
Subject
Written By
Posted
ResultSet.deleterow without primay key
April 28, 2005 08:24PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.