The bug has been reported by ###@###.###.
The following bug has been reported by a user at ###@###.###
This needs more investigation. Following is the re producible.
package rfv.sfa;
import java.sql.*;
import javax.sql.*;
import javax.sql.rowset.*;
import javax.sql.rowset.spi.*;
import com.sun.rowset.*;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2004</p>
*
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
public class TestCachedRowSet {
//private String url = "jdbc:db2://sadbarktest5:6789/TEST";
//private String url = "jdbc:mysql://192.168.128.11/matrix?user=matrix&password=matrix99";
private String url = "jdbc:db2:INFRA";
private String user = "tst001";
//private String user = "matrix";
private String password = "tst001";
//private String password = "matrix99";
private Connection connection;
private CachedRowSetImpl crs;
/**
* connect
*/
public void connect() {
try
{
//Class.forName("COM.ibm.db2.jdbc.net.DB2Driver");
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
//Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection(url,user,password);
System.out.println("Connection created...");
}
catch (SQLException sqle) {
System.out.println("SQLException: " + sqle.getMessage());
sqle.printStackTrace();
}
catch (Exception e) {
System.out.println("Exception: " + e.getMessage());
e.printStackTrace();
}
}
/**
* disconnect
*/
public void disconnect() {
try
{
connection.close();
System.out.println("Connection closed.");
}
catch (SQLException sqle) {
System.out.println("SQLException: " + sqle.getMessage());
sqle.printStackTrace();
}
catch (Exception e) {
System.out.println("Exception: " + e.getMessage());
e.printStackTrace();
}
}
/**
* run
*/
public void run() {
try
{
crs = new CachedRowSetImpl();
System.out.println("CachedRowSet created...");
crs.setUrl(url);
crs.setUsername(user);
crs.setPassword(password);
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery("select * from roller");
//ResultSet rs = statement.executeQuery("select * from TARFILTYP");
crs.populate(rs);
System.out.println("Cached Row Set populated...");
crs.moveToInsertRow();
crs.updateString(1,"anyroll");
crs.updateString(2,"anytype");
//crs.updateString(1,"newtarfile");
//crs.updateTimestamp(2,new Timestamp(00000));
crs.insertRow();
crs.moveToCurrentRow();
crs.acceptChanges();
System.out.println("Changes accepted...");
}
catch (SyncProviderException spe) {
SyncResolver resolver = spe.getSyncResolver();
try
{
while(resolver.nextConflict()) {
int row = resolver.getRow();
crs.absolute(row);
int colCount = crs.getMetaData().getColumnCount();
for (int j = 1; j <= colCount; j++) {
if (resolver.getConflictValue(j) != null) {
Object crsValue = crs.getObject(j);
Object resolverValue = resolver.getConflictValue(j);
System.out.println ("Conflict at row: " + row +
" with column: " + colCount);
}
}
}
}
catch (SQLException sqle) {
System.out.println("SQLException: " + sqle.getMessage());
sqle.printStackTrace();
}
}
catch (SQLException sqle)
{
System.out.println("SQLException: " + sqle.getMessage());
sqle.printStackTrace();
}
catch (Exception e)
{
System.out.println("Exception: " + e.getMessage());
e.printStackTrace();
}
}
/**
* TestCachedRowSet
*/
public TestCachedRowSet()
{
}
/**
* main
*
* @param args String[]
*/
public static void main(String[] args) {
TestCachedRowSet test = new TestCachedRowSet();
test.connect();
test.run();
test.disconnect();
}
}
Exception and message from user
Connecting against DB2 V8.1 with 2.0 "net" drivers...
>> Every time I use CachedRowSet to propagate changes (ie. acceptChanges
>> method)
>> with the default syncProvider (ie. I never set it) the following error
>> pops up:
>> Code:
>> javax.sql.rowset.spi.SyncProviderException: X no of conflicts while
>> synchronizing
>> at
>> com.sun.rowset.internal.CachedRowSetWriter.writeData(CachedRowSetWriter.
>> java:386)
>> at
>> com.sun.rowset.CachedRowSetImpl.acceptChanges(CachedRowSetImpl.java:810)
>> at test.TestCachedRowSet.run(TestCachedRowSet.java:101)
>> at test.TestCachedRowSet.main(TestCachedRowSet.java:134
>> SQLException: X no of conflicts while synchronizing
>>
>> If I catch the SyncProvider exception there are never in non-null values
>> (objects) to resolve (ie. I added the sample code from the
>> SyncResolver javadoc
>> page).
>> Has anybody else noticed the same problem with DB2? Same code works
>> great with
>> MySQL. It feels like the DB2 drivers (may just the net) are behaving as
>> expected.
>> Running SDK 1.4.2_01-b06 with the Tiger RowSet implementation
>> (released in
>> April this year)
>> </message
The following bug has been reported by a user at ###@###.###
This needs more investigation. Following is the re producible.
package rfv.sfa;
import java.sql.*;
import javax.sql.*;
import javax.sql.rowset.*;
import javax.sql.rowset.spi.*;
import com.sun.rowset.*;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2004</p>
*
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
public class TestCachedRowSet {
//private String url = "jdbc:db2://sadbarktest5:6789/TEST";
//private String url = "jdbc:mysql://192.168.128.11/matrix?user=matrix&password=matrix99";
private String url = "jdbc:db2:INFRA";
private String user = "tst001";
//private String user = "matrix";
private String password = "tst001";
//private String password = "matrix99";
private Connection connection;
private CachedRowSetImpl crs;
/**
* connect
*/
public void connect() {
try
{
//Class.forName("COM.ibm.db2.jdbc.net.DB2Driver");
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
//Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection(url,user,password);
System.out.println("Connection created...");
}
catch (SQLException sqle) {
System.out.println("SQLException: " + sqle.getMessage());
sqle.printStackTrace();
}
catch (Exception e) {
System.out.println("Exception: " + e.getMessage());
e.printStackTrace();
}
}
/**
* disconnect
*/
public void disconnect() {
try
{
connection.close();
System.out.println("Connection closed.");
}
catch (SQLException sqle) {
System.out.println("SQLException: " + sqle.getMessage());
sqle.printStackTrace();
}
catch (Exception e) {
System.out.println("Exception: " + e.getMessage());
e.printStackTrace();
}
}
/**
* run
*/
public void run() {
try
{
crs = new CachedRowSetImpl();
System.out.println("CachedRowSet created...");
crs.setUrl(url);
crs.setUsername(user);
crs.setPassword(password);
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery("select * from roller");
//ResultSet rs = statement.executeQuery("select * from TARFILTYP");
crs.populate(rs);
System.out.println("Cached Row Set populated...");
crs.moveToInsertRow();
crs.updateString(1,"anyroll");
crs.updateString(2,"anytype");
//crs.updateString(1,"newtarfile");
//crs.updateTimestamp(2,new Timestamp(00000));
crs.insertRow();
crs.moveToCurrentRow();
crs.acceptChanges();
System.out.println("Changes accepted...");
}
catch (SyncProviderException spe) {
SyncResolver resolver = spe.getSyncResolver();
try
{
while(resolver.nextConflict()) {
int row = resolver.getRow();
crs.absolute(row);
int colCount = crs.getMetaData().getColumnCount();
for (int j = 1; j <= colCount; j++) {
if (resolver.getConflictValue(j) != null) {
Object crsValue = crs.getObject(j);
Object resolverValue = resolver.getConflictValue(j);
System.out.println ("Conflict at row: " + row +
" with column: " + colCount);
}
}
}
}
catch (SQLException sqle) {
System.out.println("SQLException: " + sqle.getMessage());
sqle.printStackTrace();
}
}
catch (SQLException sqle)
{
System.out.println("SQLException: " + sqle.getMessage());
sqle.printStackTrace();
}
catch (Exception e)
{
System.out.println("Exception: " + e.getMessage());
e.printStackTrace();
}
}
/**
* TestCachedRowSet
*/
public TestCachedRowSet()
{
}
/**
* main
*
* @param args String[]
*/
public static void main(String[] args) {
TestCachedRowSet test = new TestCachedRowSet();
test.connect();
test.run();
test.disconnect();
}
}
Exception and message from user
Connecting against DB2 V8.1 with 2.0 "net" drivers...
>> Every time I use CachedRowSet to propagate changes (ie. acceptChanges
>> method)
>> with the default syncProvider (ie. I never set it) the following error
>> pops up:
>> Code:
>> javax.sql.rowset.spi.SyncProviderException: X no of conflicts while
>> synchronizing
>> at
>> com.sun.rowset.internal.CachedRowSetWriter.writeData(CachedRowSetWriter.
>> java:386)
>> at
>> com.sun.rowset.CachedRowSetImpl.acceptChanges(CachedRowSetImpl.java:810)
>> at test.TestCachedRowSet.run(TestCachedRowSet.java:101)
>> at test.TestCachedRowSet.main(TestCachedRowSet.java:134
>> SQLException: X no of conflicts while synchronizing
>>
>> If I catch the SyncProvider exception there are never in non-null values
>> (objects) to resolve (ie. I added the sample code from the
>> SyncResolver javadoc
>> page).
>> Has anybody else noticed the same problem with DB2? Same code works
>> great with
>> MySQL. It feels like the DB2 drivers (may just the net) are behaving as
>> expected.
>> Running SDK 1.4.2_01-b06 with the Tiger RowSet implementation
>> (released in
>> April this year)
>> </message