db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kristian Waagan (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-3431) DatabaseMetaData.getConnection returns the wrong connection when using connection pooling
Date Fri, 18 Apr 2008 12:20:21 GMT

    [ https://issues.apache.org/jira/browse/DERBY-3431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12590414#action_12590414
] 

Kristian Waagan commented on DERBY-3431:
----------------------------------------

The following test code, which I will commit when I get around to it, gives the failures below.

    /**
     * Tests that DatabaseMetaData.getConnection does not leak references to
     * physical connections or other logical connections.
     *
     * @throws SQLException if something goes wrong
     */
    public void testConnectionLeakInDatabaseMetaData()
            throws SQLException {
        ConnectionPoolDataSource cpDs =
                J2EEDataSource.getConnectionPoolDataSource();
        PooledConnection pc = cpDs.getPooledConnection();
        Connection con1 = pc.getConnection();
        DatabaseMetaData dmd1 = con1.getMetaData();
        assertSame(con1, dmd1.getConnection());
        con1.close();
        Connection con2 = pc.getConnection();
        DatabaseMetaData dmd2 = con2.getMetaData();
        assertSame(con2, dmd2.getConnection());
        assertNotSame(con2, dmd1.getConnection());
    }



There were 2 failures:
1) testConnectionLeakInDatabaseMetaData(org.apache.derbyTesting.functionTests.tests.jdbcapi.J2EEDataSourceTest)junit.framework.AssertionFailedError:
expected not same
        at org.apache.derbyTesting.functionTests.tests.jdbcapi.J2EEDataSourceTest.testConnectionLeakInDatabaseMetaData(J2EEDataSourceTest.java:2701)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:103)
        at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
        at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
        at junit.extensions.TestSetup.run(TestSetup.java:25)
        at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
2) testConnectionLeakInDatabaseMetaData(org.apache.derbyTesting.functionTests.tests.jdbcapi.J2EEDataSourceTest)junit.framework.AssertionFailedError:
expected same:<org.apache.derby.client.am.LogicalConnection40@1c8ad52> was not:<org.apache.derby.client.net.NetConnection40@1eb139e>
        at org.apache.derbyTesting.functionTests.tests.jdbcapi.J2EEDataSourceTest.testConnectionLeakInDatabaseMetaData(J2EEDataSourceTest.java:2696)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:103)
        at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
        at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
        at junit.extensions.TestSetup.run(TestSetup.java:25)
        at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
        at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
        at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
        at junit.extensions.TestSetup.run(TestSetup.java:25)
        at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
        at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
        at junit.extensions.TestSetup.run(TestSetup.java:25)
        at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)

FAILURES!!!
Tests run: 39,  Failures: 2,  Errors: 0


> DatabaseMetaData.getConnection returns the wrong connection when using connection pooling
> -----------------------------------------------------------------------------------------
>
>                 Key: DERBY-3431
>                 URL: https://issues.apache.org/jira/browse/DERBY-3431
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC, Network Client
>    Affects Versions: 10.1.3.1, 10.2.2.0, 10.3.2.1, 10.4.0.0
>         Environment: Client-server with connection pooling enabled.
>            Reporter: Kristian Waagan
>            Priority: Minor
>         Attachments: derby-3431-1a-test_repro.diff
>
>
> The connection returned from DatabaseMetaData.getConnection is not the same as the connection
used to create the meta data object when the client driver is used with connection pooling
enabled.
> For trunk, the embedded driver/ds does the right thing.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message