简体   繁体   English

更新选定的行JDBC RowSet

[英]Updating selected rows JDBC RowSet

I want to update a record in a database using JDBC RowSet. 我想使用JDBC RowSet更新数据库中的记录。 I first get the required record and then I use updateRow() to update. 我首先获得所需的记录,然后使用updateRow()进行更新。 But it doesn't get reflected on the database. 但是它并没有反映在数据库中。 There are no errors reported. 没有错误报告。

rowSet.setCommand("SELECT * FROM Employee WHERE uid="+e.getUid());
rowSet.execute();
rowSet.updateString("name", e.getName());
// More update operations
rowSet.updateRow();

This example show that you must first move to the changed line using 示例说明您必须先使用转到已更改的行

 jdbcRs.absolute(3);

to update the third row. 更新第三行。

Note also that in Oracle the rowset must be made explicitly updatable 还请注意,在Oracle中 ,必须使行集显式可更新

 rowset.setReadOnly (false);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM