You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by de...@db.apache.org on 2004/09/28 03:01:32 UTC

[jira] Created: (DERBY-8) Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction

Message:

  A new issue has been created in JIRA.

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/DERBY-8

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: DERBY-8
    Summary: Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction
       Type: Bug

     Status: Unassigned
   Priority: Minor

    Project: Derby
 Components: 
             JDBC
   Versions:
             10.0.2.0

   Assignee: 
   Reporter: Tulika Agrawal

    Created: Mon, 27 Sep 2004 6:00 PM
    Updated: Mon, 27 Sep 2004 6:00 PM

Description:
Reporting for Mamta Satoor, filed on Derby-dev list.

I think there is a bug in Derby when the user code tries to get the
Connection object from XAConnection "inside" the global transaction.
In this case, the Connection object gets created with un-supported
holdability. Look at the following piece of code and it's output to
see what exactly happens
    EmbeddedXADataSource dscsx = new EmbeddedXADataSource();
    dscsx.setDatabaseName("wombat");
    XAConnection xac = dscsx.getXAConnection("fred", "wilma");
    XAResource xr = xac.getXAResource();
    xid = getXid(27, (byte) 21, (byte) 01);
    xr.start(xid, XAResource.TMNOFLAGS);
    conn1 = xac.getConnection();
    System.out.println("This is a bug. Connection's holdability should
have been CLOSE_CURSORS_AT_COMMIT since it is in the global
transaction");
    System.out.println("CONNECTION(in xa transaction) HOLDABILITY " +
(conn1.getHoldability() == ResultSet.HOLD_CURSORS_OVER_COMMIT));
    System.out.println("Autocommit on Connection inside global
transaction has been set correctly to " + conn1.getAutoCommit());
    xr.end(xid, XAResource.TMSUCCESS);
The output for the above piece of code is
    This is a bug. Connection's holdability should have been
CLOSE_CURSORS_AT_COMMIT since it is in the global transaction
    CONNECTION(in xa transaction) HOLDABILITY true
    Autocommit on Connection inside global transaction has been set
correctly to false



---------------------------------------------------------------------
JIRA INFORMATION:
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

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-8) Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction

Posted by "Shreyas Kaushik (JIRA)" <de...@db.apache.org>.
     [ http://nagoya.apache.org/jira/browse/DERBY-8?page=comments#action_56026 ]
     
Shreyas Kaushik commented on DERBY-8:
-------------------------------------

My comments on this issue:

Both the XAResource and the Connection handle got by calling a getConnection() method on a XAConnection are child entities of the XAConnection. So the XAResource and the Connection are in parallel if a hierarchy is imagined with a XAConnection as the head. 
  So the Connection handle got by calling a getConnection method on the XAResource is not bound to have the same holdability for cursors as that of the Transaction. It should have its own holdability state.

Moreover in a managed sscenario the XAConnection interface is not directly used, we just get a java.sql.Connection handle by calling the getConnection method on the DataSource. It is the DataSource configuration that determines what all happens behind the scene to return a Connection handle.

So in my opinion Derby is behaving properly.

> Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction
> -------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-8
>          URL: http://nagoya.apache.org/jira/browse/DERBY-8
>      Project: Derby
>         Type: Bug
>   Components: JDBC
>     Versions: 10.0.2.0
>     Reporter: Tulika Agrawal
>     Priority: Minor

>
> Reporting for Mamta Satoor, filed on Derby-dev list.
> I think there is a bug in Derby when the user code tries to get the
> Connection object from XAConnection "inside" the global transaction.
> In this case, the Connection object gets created with un-supported
> holdability. Look at the following piece of code and it's output to
> see what exactly happens
>     EmbeddedXADataSource dscsx = new EmbeddedXADataSource();
>     dscsx.setDatabaseName("wombat");
>     XAConnection xac = dscsx.getXAConnection("fred", "wilma");
>     XAResource xr = xac.getXAResource();
>     xid = getXid(27, (byte) 21, (byte) 01);
>     xr.start(xid, XAResource.TMNOFLAGS);
>     conn1 = xac.getConnection();
>     System.out.println("This is a bug. Connection's holdability should
> have been CLOSE_CURSORS_AT_COMMIT since it is in the global
> transaction");
>     System.out.println("CONNECTION(in xa transaction) HOLDABILITY " +
> (conn1.getHoldability() == ResultSet.HOLD_CURSORS_OVER_COMMIT));
>     System.out.println("Autocommit on Connection inside global
> transaction has been set correctly to " + conn1.getAutoCommit());
>     xr.end(xid, XAResource.TMSUCCESS);
> The output for the above piece of code is
>     This is a bug. Connection's holdability should have been
> CLOSE_CURSORS_AT_COMMIT since it is in the global transaction
>     CONNECTION(in xa transaction) HOLDABILITY true
>     Autocommit on Connection inside global transaction has been set
> correctly to false

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Assigned: (DERBY-8) Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction

Posted by "Mamta A. Satoor (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-8?page=all ]

Mamta A. Satoor reassigned DERBY-8:
-----------------------------------

    Assign To: Mamta A. Satoor

> Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction
> -------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-8
>          URL: http://issues.apache.org/jira/browse/DERBY-8
>      Project: Derby
>         Type: Bug
>   Components: JDBC
>     Versions: 10.0.2.0
>     Reporter: Tulika Agrawal
>     Assignee: Mamta A. Satoor
>     Priority: Minor
>  Attachments: Derby8_Derby366_061805.txt
>
> Reporting for Mamta Satoor, filed on Derby-dev list.
> I think there is a bug in Derby when the user code tries to get the
> Connection object from XAConnection "inside" the global transaction.
> In this case, the Connection object gets created with un-supported
> holdability. Look at the following piece of code and it's output to
> see what exactly happens
>     EmbeddedXADataSource dscsx = new EmbeddedXADataSource();
>     dscsx.setDatabaseName("wombat");
>     XAConnection xac = dscsx.getXAConnection("fred", "wilma");
>     XAResource xr = xac.getXAResource();
>     xid = getXid(27, (byte) 21, (byte) 01);
>     xr.start(xid, XAResource.TMNOFLAGS);
>     conn1 = xac.getConnection();
>     System.out.println("This is a bug. Connection's holdability should
> have been CLOSE_CURSORS_AT_COMMIT since it is in the global
> transaction");
>     System.out.println("CONNECTION(in xa transaction) HOLDABILITY " +
> (conn1.getHoldability() == ResultSet.HOLD_CURSORS_OVER_COMMIT));
>     System.out.println("Autocommit on Connection inside global
> transaction has been set correctly to " + conn1.getAutoCommit());
>     xr.end(xid, XAResource.TMSUCCESS);
> The output for the above piece of code is
>     This is a bug. Connection's holdability should have been
> CLOSE_CURSORS_AT_COMMIT since it is in the global transaction
>     CONNECTION(in xa transaction) HOLDABILITY true
>     Autocommit on Connection inside global transaction has been set
> correctly to false

-- 
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


[jira] Commented: (DERBY-8) Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction

Posted by "Mamta A. Satoor (JIRA)" <de...@db.apache.org>.
     [ http://nagoya.apache.org/jira/browse/DERBY-8?page=comments#action_56076 ]
     
Mamta A. Satoor commented on DERBY-8:
-------------------------------------

Should we then reconsider what happens to the holdability of the connection handle(got by calling a getConnection() method on a XAConnection OUTSIDE the global transaction) when it becomes part of a global transaction? 

Following example code shows that Derby currently (silently) switches the the holdability of the connection handle from HOLD_CURSORS_OVER_COMMIT to CLOSE_CURSORS_AT_COMMIT when it becomes part of the global transaction.

    EmbeddedXADataSource dscsx = new EmbeddedXADataSource(); 
    dscsx.setDatabaseName("wombat"); 
    XAConnection xac = dscsx.getXAConnection("fred", "wilma"); 
    XAResource xr = xac.getXAResource(); 
    Xid xid = getXid(27, (byte) 21, (byte) 01); 
    Connection conn1 = xac.getConnection(); 
    System.out.println("By default, autocommit is " + conn1.getAutoCommit() + " for a connection");
    System.out.println("Default holdability for a connection is HOLD_CURSORS_OVER_COMMIT");
    System.out.println("CONNECTION(not in xa transaction yet) HOLDABILITY " + (conn1.getHoldability() == ResultSet.HOLD_CURSORS_OVER_COMMIT));
    xr.start(xid, XAResource.TMNOFLAGS);
    System.out.println("Notice that autocommit now is " + conn1.getAutoCommit() + " for connection because it is part of the global transaction");
    System.out.println("Notice that connection's holdability at this point is CLOSE_CURSORS_AT_COMMIT because it is part of the global transaction");
    System.out.println("CONNECTION(in xa transaction) HOLDABILITY " + (conn1.getHoldability() == ResultSet.HOLD_CURSORS_OVER_COMMIT));

Output of this code snippet when run under Derby is as follows.
START XA HOLDABILITY TEST
By default, autocommit is true for a connection
Default holdability for a connection is HOLD_CURSORS_OVER_COMMIT
CONNECTION(not in xa transaction yet) HOLDABILITY true
Notice that autocommit now is false for connection because it is part of the global transaction
Notice that connection's holdability at this point is CLOSE_CURSORS_AT_COMMIT because it is part of the global transaction
CONNECTION(in xa transaction) HOLDABILITY false

thanks,
Mamta

> Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction
> -------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-8
>          URL: http://nagoya.apache.org/jira/browse/DERBY-8
>      Project: Derby
>         Type: Bug
>   Components: JDBC
>     Versions: 10.0.2.0
>     Reporter: Tulika Agrawal
>     Priority: Minor

>
> Reporting for Mamta Satoor, filed on Derby-dev list.
> I think there is a bug in Derby when the user code tries to get the
> Connection object from XAConnection "inside" the global transaction.
> In this case, the Connection object gets created with un-supported
> holdability. Look at the following piece of code and it's output to
> see what exactly happens
>     EmbeddedXADataSource dscsx = new EmbeddedXADataSource();
>     dscsx.setDatabaseName("wombat");
>     XAConnection xac = dscsx.getXAConnection("fred", "wilma");
>     XAResource xr = xac.getXAResource();
>     xid = getXid(27, (byte) 21, (byte) 01);
>     xr.start(xid, XAResource.TMNOFLAGS);
>     conn1 = xac.getConnection();
>     System.out.println("This is a bug. Connection's holdability should
> have been CLOSE_CURSORS_AT_COMMIT since it is in the global
> transaction");
>     System.out.println("CONNECTION(in xa transaction) HOLDABILITY " +
> (conn1.getHoldability() == ResultSet.HOLD_CURSORS_OVER_COMMIT));
>     System.out.println("Autocommit on Connection inside global
> transaction has been set correctly to " + conn1.getAutoCommit());
>     xr.end(xid, XAResource.TMSUCCESS);
> The output for the above piece of code is
>     This is a bug. Connection's holdability should have been
> CLOSE_CURSORS_AT_COMMIT since it is in the global transaction
>     CONNECTION(in xa transaction) HOLDABILITY true
>     Autocommit on Connection inside global transaction has been set
> correctly to false

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-8) Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction

Posted by "Kathey Marsden (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-8?page=comments#action_12314196 ] 

Kathey Marsden commented on DERBY-8:
------------------------------------

Checked this in.
Transmitting file data ...............
Committed revision 191755.


> Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction
> -------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-8
>          URL: http://issues.apache.org/jira/browse/DERBY-8
>      Project: Derby
>         Type: Bug
>   Components: JDBC
>     Versions: 10.0.2.0
>     Reporter: Tulika Agrawal
>     Priority: Minor
>  Attachments: Derby8_Derby366_061805.txt
>
> Reporting for Mamta Satoor, filed on Derby-dev list.
> I think there is a bug in Derby when the user code tries to get the
> Connection object from XAConnection "inside" the global transaction.
> In this case, the Connection object gets created with un-supported
> holdability. Look at the following piece of code and it's output to
> see what exactly happens
>     EmbeddedXADataSource dscsx = new EmbeddedXADataSource();
>     dscsx.setDatabaseName("wombat");
>     XAConnection xac = dscsx.getXAConnection("fred", "wilma");
>     XAResource xr = xac.getXAResource();
>     xid = getXid(27, (byte) 21, (byte) 01);
>     xr.start(xid, XAResource.TMNOFLAGS);
>     conn1 = xac.getConnection();
>     System.out.println("This is a bug. Connection's holdability should
> have been CLOSE_CURSORS_AT_COMMIT since it is in the global
> transaction");
>     System.out.println("CONNECTION(in xa transaction) HOLDABILITY " +
> (conn1.getHoldability() == ResultSet.HOLD_CURSORS_OVER_COMMIT));
>     System.out.println("Autocommit on Connection inside global
> transaction has been set correctly to " + conn1.getAutoCommit());
>     xr.end(xid, XAResource.TMSUCCESS);
> The output for the above piece of code is
>     This is a bug. Connection's holdability should have been
> CLOSE_CURSORS_AT_COMMIT since it is in the global transaction
>     CONNECTION(in xa transaction) HOLDABILITY true
>     Autocommit on Connection inside global transaction has been set
> correctly to false

-- 
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


[jira] Resolved: (DERBY-8) Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction

Posted by "Mamta A. Satoor (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-8?page=all ]
     
Mamta A. Satoor resolved DERBY-8:
---------------------------------

    Resolution: Fixed

The fix has been committed by Kathey

> Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction
> -------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-8
>          URL: http://issues.apache.org/jira/browse/DERBY-8
>      Project: Derby
>         Type: Bug
>   Components: JDBC
>     Versions: 10.0.2.0
>     Reporter: Tulika Agrawal
>     Priority: Minor
>  Attachments: Derby8_Derby366_061805.txt
>
> Reporting for Mamta Satoor, filed on Derby-dev list.
> I think there is a bug in Derby when the user code tries to get the
> Connection object from XAConnection "inside" the global transaction.
> In this case, the Connection object gets created with un-supported
> holdability. Look at the following piece of code and it's output to
> see what exactly happens
>     EmbeddedXADataSource dscsx = new EmbeddedXADataSource();
>     dscsx.setDatabaseName("wombat");
>     XAConnection xac = dscsx.getXAConnection("fred", "wilma");
>     XAResource xr = xac.getXAResource();
>     xid = getXid(27, (byte) 21, (byte) 01);
>     xr.start(xid, XAResource.TMNOFLAGS);
>     conn1 = xac.getConnection();
>     System.out.println("This is a bug. Connection's holdability should
> have been CLOSE_CURSORS_AT_COMMIT since it is in the global
> transaction");
>     System.out.println("CONNECTION(in xa transaction) HOLDABILITY " +
> (conn1.getHoldability() == ResultSet.HOLD_CURSORS_OVER_COMMIT));
>     System.out.println("Autocommit on Connection inside global
> transaction has been set correctly to " + conn1.getAutoCommit());
>     xr.end(xid, XAResource.TMSUCCESS);
> The output for the above piece of code is
>     This is a bug. Connection's holdability should have been
> CLOSE_CURSORS_AT_COMMIT since it is in the global transaction
>     CONNECTION(in xa transaction) HOLDABILITY true
>     Autocommit on Connection inside global transaction has been set
> correctly to false

-- 
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


[jira] Updated: (DERBY-8) Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction

Posted by "Mamta A. Satoor (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-8?page=all ]

Mamta A. Satoor updated DERBY-8:
--------------------------------

    Attachment: Derby8_Derby366_061805.txt

I have a patch to fix Derby-8 (Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction) and Derby-366 (In jdk13, when a connection transitions from global transaction to local transaction, its default holdability of HOLD_CURSORS_OVER_COMMIT is not restored.) The patch is attached to both Derby-8 and Derby-366.

The fix for both these bugs was centered around fixing the holdability handling in BrokeredConnection.java This was because BrokeredConnection.java had no code for restoring the holdability of real connection object and no code for saving the current holdability state of real connection object. I put fix for both these issues in BrokeredConnection.java so that both jdk13 and jdk14+ environments will be handled correctly. Had to use reflection for this holdability work
because Connection.setHoldability and Connection.getHoldability methods are not available through JDK13 apis.

svn stat 
M      java\engine\org\apache\derby\iapi\jdbc\BrokeredConnection.java
M      java\engine\org\apache\derby\iapi\jdbc\BrokeredConnection30.java
M      java\testing\org\apache\derbyTesting\functionTests\tests\store\xaOffline1.sql
M      java\testing\org\apache\derbyTesting\functionTests\tests\store\xab2354.sql
M      java\testing\org\apache\derbyTesting\functionTests\tests\jdbcapi\xaAnotherTest.sql
M      java\testing\org\apache\derbyTesting\functionTests\tests\jdbcapi\xaSimplePositive.sql
M      java\testing\org\apache\derbyTesting\functionTests\tests\jdbcapi\xaSimpleNegative.sql
M      java\testing\org\apache\derbyTesting\functionTests\tests\jdbcapi\checkDataSource30.java
M      java\testing\org\apache\derbyTesting\functionTests\master\xaOffline1.out
M      java\testing\org\apache\derbyTesting\functionTests\master\xaSimplePositive.out
M      java\testing\org\apache\derbyTesting\functionTests\master\xab2354.out
M      java\testing\org\apache\derbyTesting\functionTests\master\xaSimpleNegative.out
M      java\testing\org\apache\derbyTesting\functionTests\master\xaAnotherTest.out
M      java\testing\org\apache\derbyTesting\functionTests\master\checkDataSource30.out

Kathey, may be you can try this fix with Network Server and see if it resolves any related issues you had there?

I have run the test suite and this fix has not caused any failures. Have changed some of the existing XA tests so that they can rely on correct holdability status inside and outside global transaction.

If no comments from anyone, can a commiter please commit this patch?


> Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction
> -------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-8
>          URL: http://issues.apache.org/jira/browse/DERBY-8
>      Project: Derby
>         Type: Bug
>   Components: JDBC
>     Versions: 10.0.2.0
>     Reporter: Tulika Agrawal
>     Priority: Minor
>  Attachments: Derby8_Derby366_061805.txt
>
> Reporting for Mamta Satoor, filed on Derby-dev list.
> I think there is a bug in Derby when the user code tries to get the
> Connection object from XAConnection "inside" the global transaction.
> In this case, the Connection object gets created with un-supported
> holdability. Look at the following piece of code and it's output to
> see what exactly happens
>     EmbeddedXADataSource dscsx = new EmbeddedXADataSource();
>     dscsx.setDatabaseName("wombat");
>     XAConnection xac = dscsx.getXAConnection("fred", "wilma");
>     XAResource xr = xac.getXAResource();
>     xid = getXid(27, (byte) 21, (byte) 01);
>     xr.start(xid, XAResource.TMNOFLAGS);
>     conn1 = xac.getConnection();
>     System.out.println("This is a bug. Connection's holdability should
> have been CLOSE_CURSORS_AT_COMMIT since it is in the global
> transaction");
>     System.out.println("CONNECTION(in xa transaction) HOLDABILITY " +
> (conn1.getHoldability() == ResultSet.HOLD_CURSORS_OVER_COMMIT));
>     System.out.println("Autocommit on Connection inside global
> transaction has been set correctly to " + conn1.getAutoCommit());
>     xr.end(xid, XAResource.TMSUCCESS);
> The output for the above piece of code is
>     This is a bug. Connection's holdability should have been
> CLOSE_CURSORS_AT_COMMIT since it is in the global transaction
>     CONNECTION(in xa transaction) HOLDABILITY true
>     Autocommit on Connection inside global transaction has been set
> correctly to false

-- 
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


[jira] Closed: (DERBY-8) Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction

Posted by "Mamta A. Satoor (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-8?page=all ]
     
Mamta A. Satoor closed DERBY-8:
-------------------------------

    Fix Version: 10.2.0.0
                 10.1.1.0
     Resolution: Fixed

> Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction
> -------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-8
>          URL: http://issues.apache.org/jira/browse/DERBY-8
>      Project: Derby
>         Type: Bug

>   Components: JDBC
>     Versions: 10.0.2.0
>     Reporter: Tulika Agrawal
>     Assignee: Mamta A. Satoor
>     Priority: Minor
>      Fix For: 10.2.0.0, 10.1.1.0
>  Attachments: Derby8_Derby366_061805.txt
>
> Reporting for Mamta Satoor, filed on Derby-dev list.
> I think there is a bug in Derby when the user code tries to get the
> Connection object from XAConnection "inside" the global transaction.
> In this case, the Connection object gets created with un-supported
> holdability. Look at the following piece of code and it's output to
> see what exactly happens
>     EmbeddedXADataSource dscsx = new EmbeddedXADataSource();
>     dscsx.setDatabaseName("wombat");
>     XAConnection xac = dscsx.getXAConnection("fred", "wilma");
>     XAResource xr = xac.getXAResource();
>     xid = getXid(27, (byte) 21, (byte) 01);
>     xr.start(xid, XAResource.TMNOFLAGS);
>     conn1 = xac.getConnection();
>     System.out.println("This is a bug. Connection's holdability should
> have been CLOSE_CURSORS_AT_COMMIT since it is in the global
> transaction");
>     System.out.println("CONNECTION(in xa transaction) HOLDABILITY " +
> (conn1.getHoldability() == ResultSet.HOLD_CURSORS_OVER_COMMIT));
>     System.out.println("Autocommit on Connection inside global
> transaction has been set correctly to " + conn1.getAutoCommit());
>     xr.end(xid, XAResource.TMSUCCESS);
> The output for the above piece of code is
>     This is a bug. Connection's holdability should have been
> CLOSE_CURSORS_AT_COMMIT since it is in the global transaction
>     CONNECTION(in xa transaction) HOLDABILITY true
>     Autocommit on Connection inside global transaction has been set
> correctly to false

-- 
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


[jira] Commented: (DERBY-8) Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction

Posted by "Daniel John Debrunner (JIRA)" <de...@db.apache.org>.
     [ http://nagoya.apache.org/jira/browse/DERBY-8?page=comments#action_56080 ]
     
Daniel John Debrunner commented on DERBY-8:
-------------------------------------------

I think the point is being missed that Derby does not support holdability when in a global transaction, thus holdability should always be CLOSE_CURSORS_AT_COMMIT when in a global transaction, regardless of the state set by the connection in local mode. So I believe the bug summary is correct, and there is a bug.

> Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction
> -------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-8
>          URL: http://nagoya.apache.org/jira/browse/DERBY-8
>      Project: Derby
>         Type: Bug
>   Components: JDBC
>     Versions: 10.0.2.0
>     Reporter: Tulika Agrawal
>     Priority: Minor

>
> Reporting for Mamta Satoor, filed on Derby-dev list.
> I think there is a bug in Derby when the user code tries to get the
> Connection object from XAConnection "inside" the global transaction.
> In this case, the Connection object gets created with un-supported
> holdability. Look at the following piece of code and it's output to
> see what exactly happens
>     EmbeddedXADataSource dscsx = new EmbeddedXADataSource();
>     dscsx.setDatabaseName("wombat");
>     XAConnection xac = dscsx.getXAConnection("fred", "wilma");
>     XAResource xr = xac.getXAResource();
>     xid = getXid(27, (byte) 21, (byte) 01);
>     xr.start(xid, XAResource.TMNOFLAGS);
>     conn1 = xac.getConnection();
>     System.out.println("This is a bug. Connection's holdability should
> have been CLOSE_CURSORS_AT_COMMIT since it is in the global
> transaction");
>     System.out.println("CONNECTION(in xa transaction) HOLDABILITY " +
> (conn1.getHoldability() == ResultSet.HOLD_CURSORS_OVER_COMMIT));
>     System.out.println("Autocommit on Connection inside global
> transaction has been set correctly to " + conn1.getAutoCommit());
>     xr.end(xid, XAResource.TMSUCCESS);
> The output for the above piece of code is
>     This is a bug. Connection's holdability should have been
> CLOSE_CURSORS_AT_COMMIT since it is in the global transaction
>     CONNECTION(in xa transaction) HOLDABILITY true
>     Autocommit on Connection inside global transaction has been set
> correctly to false

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Closed: (DERBY-8) Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction

Posted by "Mamta A. Satoor (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-8?page=all ]
     
Mamta A. Satoor closed DERBY-8:
-------------------------------


> Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction
> -------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-8
>          URL: http://issues.apache.org/jira/browse/DERBY-8
>      Project: Derby
>         Type: Bug
>   Components: JDBC
>     Versions: 10.0.2.0
>     Reporter: Tulika Agrawal
>     Priority: Minor
>  Attachments: Derby8_Derby366_061805.txt
>
> Reporting for Mamta Satoor, filed on Derby-dev list.
> I think there is a bug in Derby when the user code tries to get the
> Connection object from XAConnection "inside" the global transaction.
> In this case, the Connection object gets created with un-supported
> holdability. Look at the following piece of code and it's output to
> see what exactly happens
>     EmbeddedXADataSource dscsx = new EmbeddedXADataSource();
>     dscsx.setDatabaseName("wombat");
>     XAConnection xac = dscsx.getXAConnection("fred", "wilma");
>     XAResource xr = xac.getXAResource();
>     xid = getXid(27, (byte) 21, (byte) 01);
>     xr.start(xid, XAResource.TMNOFLAGS);
>     conn1 = xac.getConnection();
>     System.out.println("This is a bug. Connection's holdability should
> have been CLOSE_CURSORS_AT_COMMIT since it is in the global
> transaction");
>     System.out.println("CONNECTION(in xa transaction) HOLDABILITY " +
> (conn1.getHoldability() == ResultSet.HOLD_CURSORS_OVER_COMMIT));
>     System.out.println("Autocommit on Connection inside global
> transaction has been set correctly to " + conn1.getAutoCommit());
>     xr.end(xid, XAResource.TMSUCCESS);
> The output for the above piece of code is
>     This is a bug. Connection's holdability should have been
> CLOSE_CURSORS_AT_COMMIT since it is in the global transaction
>     CONNECTION(in xa transaction) HOLDABILITY true
>     Autocommit on Connection inside global transaction has been set
> correctly to false

-- 
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


[jira] Reopened: (DERBY-8) Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction

Posted by "Mamta A. Satoor (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-8?page=all ]
     
Mamta A. Satoor reopened DERBY-8:
---------------------------------


Need to put correct fix-in version

> Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction
> -------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-8
>          URL: http://issues.apache.org/jira/browse/DERBY-8
>      Project: Derby
>         Type: Bug

>   Components: JDBC
>     Versions: 10.0.2.0
>     Reporter: Tulika Agrawal
>     Assignee: Mamta A. Satoor
>     Priority: Minor
>      Fix For: 10.2.0.0, 10.1.1.0
>  Attachments: Derby8_Derby366_061805.txt
>
> Reporting for Mamta Satoor, filed on Derby-dev list.
> I think there is a bug in Derby when the user code tries to get the
> Connection object from XAConnection "inside" the global transaction.
> In this case, the Connection object gets created with un-supported
> holdability. Look at the following piece of code and it's output to
> see what exactly happens
>     EmbeddedXADataSource dscsx = new EmbeddedXADataSource();
>     dscsx.setDatabaseName("wombat");
>     XAConnection xac = dscsx.getXAConnection("fred", "wilma");
>     XAResource xr = xac.getXAResource();
>     xid = getXid(27, (byte) 21, (byte) 01);
>     xr.start(xid, XAResource.TMNOFLAGS);
>     conn1 = xac.getConnection();
>     System.out.println("This is a bug. Connection's holdability should
> have been CLOSE_CURSORS_AT_COMMIT since it is in the global
> transaction");
>     System.out.println("CONNECTION(in xa transaction) HOLDABILITY " +
> (conn1.getHoldability() == ResultSet.HOLD_CURSORS_OVER_COMMIT));
>     System.out.println("Autocommit on Connection inside global
> transaction has been set correctly to " + conn1.getAutoCommit());
>     xr.end(xid, XAResource.TMSUCCESS);
> The output for the above piece of code is
>     This is a bug. Connection's holdability should have been
> CLOSE_CURSORS_AT_COMMIT since it is in the global transaction
>     CONNECTION(in xa transaction) HOLDABILITY true
>     Autocommit on Connection inside global transaction has been set
> correctly to false

-- 
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