日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

com.mysql.jdbc.NotUpdatable: Result Set not updatable (references no primary keys).(解决方法)

發布時間:2023/12/3 46 豆豆
生活随笔 收集整理的這篇文章主要介紹了 com.mysql.jdbc.NotUpdatable: Result Set not updatable (references no primary keys).(解决方法) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

【1】異常詳細信息

com.mysql.jdbc.NotUpdatable: Result Set not updatable (references no primary keys).
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.
at com.mysql.jdbc.UpdatableResultSet.generateStatements(UpdatableResultSet.java:628)
at com.mysql.jdbc.UpdatableResultSet.syncUpdate(UpdatableResultSet.java:1537)
at com.mysql.jdbc.UpdatableResultSet.updateString(UpdatableResultSet.java:2493)
at com.mysql.jdbc.UpdatableResultSet.updateString(UpdatableResultSet.java:2531)
at com.corejava.chapter4.UpdatableResultSet.main(UpdatableResultSet.java:50)


【2】解決方法

1)粗體第一行:提示sql 執行的對象(數據庫表)沒有主鍵,務必添加主鍵;

2)粗體第二行: sql 中的 select 語句必須要查詢主鍵列名, 如

String sql = “select id, name from student”; //雖然我只想查詢name,但由于id 是主鍵,select 語句中必須包含 id ;

總結

以上是生活随笔為你收集整理的com.mysql.jdbc.NotUpdatable: Result Set not updatable (references no primary keys).(解决方法)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。