Cannot rollback to savepoint when using ClientXADataSource
----------------------------------------------------------

         Key: DERBY-899
         URL: http://issues.apache.org/jira/browse/DERBY-899
     Project: Derby
        Type: Bug
  Components: Network Client, Network Server  
    Versions: 10.1.1.0, 10.1.1.1    
    Reporter: Kathey Marsden
     Fix For: 10.2.0.0



save points don't seem to be working with DerbyClient using 
XA.

levels i am on:
10.1.2.2
Apache Derby

Exception thrown is:

Exception in thread "main" 
org.apache.derby.client.am.SqlException: SAVEPOINT, MyPoint 
does not  exist or is not active in the current transaction.
        at org.apache.derby.client.am.Statement.completeSqlca(Unknown 
Source)
        at 
org.apache.derby.client.am.Statement.completeExecuteImmediate(Un
known Source)
        at 
org.apache.derby.client.net.NetStatementReply.parseEXCSQLIMMrepl
y(Unknown Source)
        at 
org.apache.derby.client.net.NetStatementReply.readExecuteImmedia
te(Unknown Source)
        at 
org.apache.derby.client.net.StatementReply.readExecuteImmediate(
Unknown Source)
        at 
org.apache.derby.client.net.NetStatement.readExecuteImmediate_(U
nknown Source)
        at 
org.apache.derby.client.am.Statement.readExecuteImmediate(Unknow
n Source)
        at org.apache.derby.client.am.Statement.flowExecute(Unknown 
Source)
        at org.apache.derby.client.am.Statement.executeX(Unknown 
Source)
        at org.apache.derby.client.am.Connection.rollback(Unknown 
Source)
        at 
org.apache.derby.client.am.LogicalConnection.rollback(Unknown 
Source)
        at 
Derby.networkServer.NSConnection.main(NSConnection.java:103)

Test case below 

class SavePointProblem337977  
{
    
    public static void main (String args [])throws Exception {
        //org.apache.derby.jdbc.ClientConnectionPoolDataSource ds 
= new org.apache.derby.jdbc.ClientConnectionPoolDataSource();
        org.apache.derby.jdbc.ClientXADataSource ds = new 
org.apache.derby.jdbc.ClientXADataSource();
        
        Connection conn = null;
        ds.setDatabaseName("e:\\temp\\sampl127;create=true");

        XAConnection xaCon = ds.getXAConnection() ;
         //PooledConnection xaCon = ds.getPooledConnection() ;
         
         
         conn = xaCon.getConnection();

        
        
        DatabaseMetaData md = conn.getMetaData() ;
        System.out.println(md.getDatabaseProductVersion());
        System.out.println(md.getDatabaseProductName());

        Statement st = null;
        PreparedStatement ps1 = null;
         try
         {
             st = conn.createStatement ();
             try
             {
                st.executeUpdate ("drop table TAB1");
             }catch (SQLException x)
             {
                System.out.println ("no table exists");
             }
             
             ps1 = conn.prepareStatement("CREATE TABLE 
TAB1(COL1 INT NOT NULL)");
             ps1.executeUpdate();

             conn.commit ();
         } catch (SQLException x)
         {
             System.out.println ("table already exists");
         }
         
         
         conn.setAutoCommit(false);
         conn.createStatement().execute("update tab1 set col1 = 
-1 where col1 = 9");
         Savepoint savepoint1 = conn.setSavepoint("MyPoint");

         conn.rollback(savepoint1);
            }
}


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to