Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6417307
Votes 1
Synopsis SyncResolver.getConflictValue(int) throws SQLException: Invalid cursor position
Category jdbc:rowset_implementation
Reported Against b81
Release Fixed mustang(b95)
State 11-Closed, Verified, bug
Priority: 2-High
Related Bugs
Submit Date 24-APR-2006
Description
JDK          :   Java HotSpot(TM) Client VM (build 1.6.0-beta2-b81, mixed mode)
DB           :   Oracle 9i, DB2 8.1, SQL Server 2000
Driver       :   Oracle/I-Net Oranxo.jar, DB2/DataDirect 3.4, SQL Server/I-Net Merlia.jar
Platform[s]  :   Any


Test source location:
=====================
/net/cady/export/dtf/unified/knight-ws/suites/jdbc/jdbc/src/javax_sql_rowset/syncresolver/SyncResolver1_003/SyncResolver1_003.java


Testcase Description (SyncResolver1_003):
=========================================
Check the default constructor for CachedRowSet instance without arguments. An implementation of CachedRowSet should be able to get a CahedRowSet handle.


How to reproduce:
=================
1) cd /net/cady/export/sqa/js159705/jdbc/bugs/[bug id]
2) ksh Run_Standalone.ksh
3) Results will be in workDir/$username.$os.$arch/$testcase/ directory.

Other options:
To change other options (such as changing the JDK, database, connection string), you can edit setup file in that directory before running the Run_Standalone.ksh.

Tonga Log output:
=================
[2006-04-24T21:23:07.10] SQL Exception encountered Invalid cursor position
[2006-04-24T21:23:13.64] Error: SyncResolver1_003 : CachedRowSet Test Failed
[2006-04-24T21:23:13.64] com.sun.j2se_sqe.jdbc.utils.TestFailureException: CachedRowSet Test Failed
[2006-04-24T21:23:13.64]        at SyncResolver1_003.doTest(SyncResolver1_003.java:195)
[2006-04-24T21:23:13.64]        at SyncResolver1_003.main(SyncResolver1_003.java:240)
[2006-04-24T21:23:13.64] Caused by: java.sql.SQLException: Invalid cursor position
[2006-04-24T21:23:13.64]        at com.sun.rowset.internal.SyncResolverImpl.getConflictValue(SyncResolverImpl.java:136)
[2006-04-24T21:23:13.64]        at SyncResolver1_003.doTest(SyncResolver1_003.java:179)
[2006-04-24T21:23:13.64]        ... 1 more
[2006-04-24T21:23:13.64] PropertyReader: SQL_DIR_PATH=/home/js159705/test/workDir
[2006-04-24T21:23:13.64] PropertyReader: SQL_FILE_NAME=initdb.conf
[2006-04-24T21:23:13.64] PropertyReader: SQL_ABS_PATH=/home/js159705/test/workDir/initdb.conf
[2006-04-24T21:23:13.64] Got two connection handles
[2006-04-24T21:23:13.64] Setting table name as:tmp_rowset3
[2006-04-24T21:23:13.64] Setting key columns for CachedRowSet
[2006-04-24T21:23:13.64] Populated a RowSet.
[2006-04-24T21:23:13.64] Size of rowset is :5
[2006-04-24T21:23:13.64] Inserted a row in the cachedrowset
[2006-04-24T21:23:13.64] Creating a new Statement  customer 
[2006-04-24T21:23:13.64] Got a new ResultSet  customer 
[2006-04-24T21:23:13.64] Inserted a row in the database
[2006-04-24T21:23:13.64] SPE thrown. Getting the sync resolver  customer 
[2006-04-24T21:23:13.64] Got the sync resolver  customer  :  xxxxx@xxxxx  
[2006-04-24T21:23:13.64] In SyncResolver.INSERT_ROW_CONFLICT


Test case code:
===============
    /**
     * @testName:         SyncResolver1_003 (same as SyncResolver1/testSyncResolverInsert)
     *
     * @assertion:
     *
     * @test_Strategy:    Check the default constructor for CachedRowSet
     *                    instance without arguments.
     *                    An implementation of CachedRowSet should be able
     *                    to get a CahedRowSet handle.
     */
    public void doTest() throws TestFailureException {
        try {
            int keyCols[] = {3};
            int row,colConflict;
            boolean bool = false;

            Statement stmt1, stmt2;
            ResultSet rs1,rs2;
            Connection con1, con2;

            CachedRowSet crs;

            con1 = DriverManager.getConnection(strUrl, strUserId, strPassword);
            con2 = DriverManager.getConnection(strUrl, strUserId, strPassword);
            logMsg("Got two connection handles");

            stmt1 = con1.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
            rs1 = stmt1.executeQuery(strQuery3);

            crs = new CachedRowSetImpl();

            crs.setTableName("tmp_rowset3");
            logMsg("Setting table name as:"+crs.getTableName());

            crs.setKeyColumns(keyCols);
            logMsg("Setting key columns for CachedRowSet ");

            crs.setCommand(strQuery3);

            crs.populate(rs1);
            logMsg("Populated a RowSet. ");
            logMsg("Size of rowset is :"+crs.size());


            crs.moveToInsertRow();
            crs.updateInt(1,6);
            crs.updateString(2,"six");
            crs.updateInt(3,60);
            crs.insertRow();
            crs.moveToCurrentRow();
            logMsg("Inserted a row in the cachedrowset");

            stmt2 = con2.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
            logMsg("Creating a new Statement  customer ");

            rs2 = stmt2.executeQuery(strQuery3);
            logMsg("Got a new ResultSet  customer ");
            rs2.beforeFirst();

            row = 0;
            rs2.moveToInsertRow();
            rs2.updateInt(1,6);
            rs2.updateString(2,"sixsix");
            rs2.updateDouble(3,600);
            rs2.insertRow();

            rs2.moveToCurrentRow();
            logMsg("Inserted a row in the database");

            try {

                crs.acceptChanges(con1);

            } catch(SyncProviderException spe){

                logMsg("SPE thrown. Getting the sync resolver  customer ");

                SyncResolver syncRes = spe.getSyncResolver();
                logMsg("Got the sync resolver  customer  :"+syncRes);

                row = 1;

                while(syncRes.nextConflict()) {

                    Object obj1 = "cachedrowset";
                    Integer obj2 = new Integer(2);

                    if(syncRes.getStatus() == SyncResolver.INSERT_ROW_CONFLICT ) {
                        logMsg("In SyncResolver.INSERT_ROW_CONFLICT");
                        for(int j=1;j<= crs.getMetaData().getColumnCount();j++) {
                            logMsg("Conflicted value is :"+ syncRes.getConflictValue(j));
                        } //end for
                        bool = true;
                    }

                } //end while

                if(!bool) {
                    throw new TestFailureException("RowSet test failed.");
                }
            }

            crs.commit();

        } catch (SQLException sqle) {
            logErr("SQL Exception encountered " + sqle.getMessage());
            throw new TestFailureException("CachedRowSet Test Failed", sqle);
        } catch (Exception e) {
            logErr("Unexpected Exception " + e.getMessage());
            throw new TestFailureException("CachedRowSet Test Failed", e);
        }
    }
Posted Date : 2006-04-24 22:14:32.0
Work Around
N/A
Evaluation
This has been fixed.
Posted Date : 2006-06-07 09:10:46.0
Comments
  
  Include a link with my name & email   

Submitted On 06-MAY-2006
guerre2
It is a very frustrating bug. I have same problem with MySql, and have days searching "My bug". 



PLEASE NOTE: JDK6 is formerly known as Project Mustang