JDBC中的一些问题!
来源:互联网 发布:什么交友软件好 编辑:程序博客网 时间:2024/04/29 10:39
com.mysql.jdbc.NotUpdatable: Result Set not updatable (referenced table has 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.
大概是说:ResultSet对象中没有更新这个功能。要想让resultset对象拥有这个功能,那就必须在其创建statement对象,指定某些功能加进去。
具体的做法是:
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
那就行了。
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.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.
如果第一个问题已经解决了,还出现上面的问题,那就是说该数据表中的字段值没有primary key。所以必须要修改其数据表结构。
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSConnection.<init>(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at JDBC.SQLDemo.main(SQLDemo.java:20当出现上面的问题时,说明我现在安装SQLServer2000还没有升级,现在我去下载补丁SP4。安装SP4,相当于把其相关文件解压放入某个目录下。然后,双击安装目录下文件夹里的“setup.bat”文件,才开始真正安装SP4补丁文件。升级成功安装后。运行JDBC可成功的与数据库连接。
- JDBC中的一些问题!
- JDBC 中的一些技巧
- 【新手经验分享】有关MYSQL和JDBC应用中的一些问题整合
- jdbc中的日期类型问题
- JDBC中的SQL注入问题
- 【JDBC开发】JDBC一些值得注意的细节问题
- Torque中的一些问题
- Torque中的一些问题
- 事务中的一些问题
- 项目中的一些问题
- JBoss中的一些问题
- arm中的一些问题
- struts2中的一些问题
- web中的一些问题
- VS2008中的一些问题
- 项目中的一些问题
- android中的一些问题
- C++中的一些问题
- HDU 1232 畅通工程
- 在Windows下利用PowerShell脚本定时删除过期文件
- 编程珠玑1.9题的别人的分析加上愚见
- 设置默认的显示方式为横屏
- UVAlive 6131 dp+斜率优化
- JDBC中的一些问题!
- python lock
- 程序员求职之道(《程序员面试笔试宝典》)之程序员如何保持身心健康?
- %6.2f
- 明文显示密码
- 弹出模态窗口关闭并刷新父窗体
- 40+个性鲜明的企业网站展示
- coco2d-html5制作弹弓射鸟第一部分---橡皮筋
- 避免XML节点命名冲突——命名空间