In DB2, it is return SQLSTAT = 24512 which is "The result table does not agree with base table." when updateRow is called.
DataBase: DB2
JDK: 5.0u2
RowSet2.0
Test failures
==============
cachedrowset.cachedrowset8.CachedRowSet8#testCRSacceptChanges3
Output
=======
com.ibm.db2.jcc.b.SqlException: DB2 SQL error: SQLCODE: -224, SQLSTATE: 24512, SQLERRMC: SQL_CURSH200C1
at com.ibm.db2.jcc.b.zc.d(zc.java:1351)
at com.ibm.db2.jcc.a.db.l(db.java:366)
at com.ibm.db2.jcc.a.db.a(db.java:64)
at com.ibm.db2.jcc.a.r.a(r.java:48)
at com.ibm.db2.jcc.a.tb.c(tb.java:266)
at com.ibm.db2.jcc.b.rc.T(rc.java:3070)
at com.ibm.db2.jcc.b.rc.G(rc.java:2849)
at com.ibm.db2.jcc.b.rc.B(rc.java:2492)
at com.ibm.db2.jcc.b.rc.updateRow(rc.java:2440)
at jdbc_try.main(jdbc_try.java:34)
Sample
=======
Make sure you have add the DB IP and the user name and user name password.
import java.sql.*;
public class jdbc_try
{
public static void main(String args[])
{
Connection con = null;
try
{
String driver ="com.ibm.db2.jcc.DB2Driver";
String url = "jdbc:db2://127.0.0.0:50000/user1";
Class.forName(driver).newInstance();
Statement s;
con = DriverManager.getConnection(url, "user1", "user1_passwd");
s = con.createStatement();
s.executeUpdate("DROP TABLE test");
s.executeUpdate("CREATE TABLE test (age INT, name VARCHAR(50))");
s.executeUpdate ("insert into test values(2,null)");
s.close();
s = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
ResultSet result1 = s.executeQuery ("Select * from test");
result1.next();
result1.updateString(2,"abc");
result1.updateRow();
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
###@###.### 2005-04-05 06:16:38 GMT
Additional Tests
=================
cachedrowset.cachedrowset8.CachedRowSet8#testCRSacceptChanges4
###@###.### 2005-04-19 01:33:25 GMT
jdbcrowset.jdbcrowset7.JdbcRowSet7#testJdbcupdateDate1
jdbcrowset.jdbcrowset7.JdbcRowSet7#testJdbcupdateDate2
jdbcrowset.jdbcrowset7.JdbcRowSet7#testJdbcupdateTimestamp1
jdbcrowset.jdbcrowset7.JdbcRowSet7#testJdbcupdateTimestamp2
jdbcrowset.jdbcrowset7.JdbcRowSet7#testJdbcupdateInt1
jdbcrowset.jdbcrowset7.JdbcRowSet7#testJdbcupdateInt2
jdbcrowset.jdbcrowset8.JdbcRowSet8#testJdbcupdateBigDecimal4
###@###.### 2005-04-19 22:23:33 GMT
###@###.### 2005-04-19 22:31:21 GMT
###@###.### 2005-04-20 00:20:56 GMT
DataBase: DB2
JDK: 5.0u2
RowSet2.0
Test failures
==============
cachedrowset.cachedrowset8.CachedRowSet8#testCRSacceptChanges3
Output
=======
com.ibm.db2.jcc.b.SqlException: DB2 SQL error: SQLCODE: -224, SQLSTATE: 24512, SQLERRMC: SQL_CURSH200C1
at com.ibm.db2.jcc.b.zc.d(zc.java:1351)
at com.ibm.db2.jcc.a.db.l(db.java:366)
at com.ibm.db2.jcc.a.db.a(db.java:64)
at com.ibm.db2.jcc.a.r.a(r.java:48)
at com.ibm.db2.jcc.a.tb.c(tb.java:266)
at com.ibm.db2.jcc.b.rc.T(rc.java:3070)
at com.ibm.db2.jcc.b.rc.G(rc.java:2849)
at com.ibm.db2.jcc.b.rc.B(rc.java:2492)
at com.ibm.db2.jcc.b.rc.updateRow(rc.java:2440)
at jdbc_try.main(jdbc_try.java:34)
Sample
=======
Make sure you have add the DB IP and the user name and user name password.
import java.sql.*;
public class jdbc_try
{
public static void main(String args[])
{
Connection con = null;
try
{
String driver ="com.ibm.db2.jcc.DB2Driver";
String url = "jdbc:db2://127.0.0.0:50000/user1";
Class.forName(driver).newInstance();
Statement s;
con = DriverManager.getConnection(url, "user1", "user1_passwd");
s = con.createStatement();
s.executeUpdate("DROP TABLE test");
s.executeUpdate("CREATE TABLE test (age INT, name VARCHAR(50))");
s.executeUpdate ("insert into test values(2,null)");
s.close();
s = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
ResultSet result1 = s.executeQuery ("Select * from test");
result1.next();
result1.updateString(2,"abc");
result1.updateRow();
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
###@###.### 2005-04-05 06:16:38 GMT
Additional Tests
=================
cachedrowset.cachedrowset8.CachedRowSet8#testCRSacceptChanges4
###@###.### 2005-04-19 01:33:25 GMT
jdbcrowset.jdbcrowset7.JdbcRowSet7#testJdbcupdateDate1
jdbcrowset.jdbcrowset7.JdbcRowSet7#testJdbcupdateDate2
jdbcrowset.jdbcrowset7.JdbcRowSet7#testJdbcupdateTimestamp1
jdbcrowset.jdbcrowset7.JdbcRowSet7#testJdbcupdateTimestamp2
jdbcrowset.jdbcrowset7.JdbcRowSet7#testJdbcupdateInt1
jdbcrowset.jdbcrowset7.JdbcRowSet7#testJdbcupdateInt2
jdbcrowset.jdbcrowset8.JdbcRowSet8#testJdbcupdateBigDecimal4
###@###.### 2005-04-19 22:23:33 GMT
###@###.### 2005-04-19 22:31:21 GMT
###@###.### 2005-04-20 00:20:56 GMT