Why do I see NotUpdatable when I invoke ResultSet.refreshRow()?

怎甘沉沦 提交于 2019-12-02 02:05:18

When you are using, ResultSet.CONCUR_READ_ONLY, you are getting an exception, that

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, can not use functions and must select all primary keys from that table. See the JDBC 2.1 API Specification, section 5.6 for more details.\

So, changing ResultSet.CONCUR_READ_ONLY to ResultSet.CONCUR_UPDATABLE, solved your problem. Correct?

Now, as I understand, you don't want to do that. Am I right? If yes, then I think you are confusing ResultSet with Database,

  • ResultSet.CONCUR_READ_ONLY, means read only ResultSet, not Database, similarly
  • ResultSet.CONCUR_UPDATABLE, means updatable ResultSet, not Database.

The method, resultSet.refreshRow(), suppose to update the resultSet, hence it rightly requires updatable ResultSet. I hope it's clear now.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!