JDBC-ORACLE10g BUG
来源:互联网 发布:dw软件全称 编辑:程序博客网 时间:2024/06/10 07:50
[From]: http://www.thatisjava.com/jdbc/69759/
The actual problem I have is not to get the update counts.
After several test case scenarios, I found out some interesting facts.
1. As I said in the beginning of my thread, As per the the API, the executeUpdate() method returns either "the row count for INSERT, UPDATE, or DELETE statements or 0 for SQL statements that return nothing" .
The executeUpdate() would return the rowCount only for the PreparedStatement andStatement. Although the CallableStatement extends the executeUpdate() of the Statement Interface, this wouldnot return a rowCount, even if the call to the procedure makes several updates/inserts in the database. The executeStatement() on the callableStatement would return 1 if there was anOUT parameter inside the called Procedure, else it would return 0.
2. We were writing our logic based on this return Value as below:
int primaryId = Obj.getPrimaryId(); returnValue = p_CallStmt.executeUpdate(); if(returnValue != 0){// If the procedure has an OUT Parameter primaryId = p_CallStmt.getInt(1); // This is the OUT Parameter returned by the Procedure}else{//if no OUT parameter, return a default key value} return primaryId;
3. Everything was fine with 9i Drivers. When no OUT parameter was returned, the executeUpdate() returned 0 and the control goes into the else loop returning default value.
In 10g JDBC Drivers, the executeUpdate() always returns 1. So even if there was no OUT parameter from the Procedure, the program still tries to get p_CallStmt.getInt(1) and throws a NullPointerException.
The solution I came up with was to register the OUT parameter even if you don't
have an OUT parameter. This would give us the required primaryId which we passed to the procedure. sometimes, if the primaryId gets changed in the procedure, it will be returned through the OUT parameter.
- JDBC-ORACLE10g BUG
- Java jdbc连接oracle10g
- Java jdbc oracle10g
- jdbc链接数据库(oracle10g)
- 使用jdbc连接oracle10g数据库
- Oracle10g(10.2.0.1)的一个bug
- Oracle10g Bug 4612267 补丁安装备忘录
- Oracle10g Bug 4612267 补丁安装备忘录
- jdbc executeBatch bug
- mysql JDBC bug
- oracle10g下JDBC驱动包的区别
- Eclipse 用JDBC连接oracle10g数据库
- JDBC读写Oracle10g的CLOB、BLOB
- JDBC读写Oracle10g的CLOB、BLOB
- jdbc连接oracle10g测试数据库插入
- JDBC Connection.commit()的bug
- mysql的jdbc驱动程序bug
- ORACLE10G 出现00600的一个BUG的解决方案
- Windows服务端口大全
- Jquery插件开发
- Gaussian blur
- jquery ui tabs 切换TAB事件 获得当前TAB ID
- Linux中crontab-定时任务命令
- JDBC-ORACLE10g BUG
- postgresql获得一个插入的序列号的值
- Ecplise -- 版本号
- SequenceInputStream学习
- JPA的Id注解
- red hat 连接外网设置
- Android中LOG机制详解(上)
- oracle创建表空间
- (Android实战)ProgressBar+AsyncTask实现界面数据异步加载(含效果图)