commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 12409] New: - Connection can be closed twice
Date Mon, 09 Sep 2002 03:20:16 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12409>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12409

Connection can be closed twice

           Summary: Connection can be closed twice
           Product: Commons
           Version: 1.0 Final
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Blocker
          Priority: Other
         Component: Dbcp
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: jihh@neusoft.com


public static void main(String[] args)
                     throws Exception
    {
        int i;
        setupDriver();
        Connection con1, con2, con3;
        con1 = DriverManager.getConnection("jdbc:apache:commons:dbcp:example");
        System.out.println(con1);
        con1.close();
        try{con1.close();}catch (Exception e){System.out.println(e);}
        con1 = DriverManager.getConnection("jdbc:apache:commons:dbcp:example");
        System.out.println(con1);
        con2 = DriverManager.getConnection("jdbc:apache:commons:dbcp:example");
        System.out.println(con2);
        con3 = DriverManager.getConnection("jdbc:apache:commons:dbcp:example");
        System.out.println(con3);

    }

    public static void setupDriver()
                            throws Exception
    {
        ObjectPool connectionPool = new GenericObjectPool(null, 10, 
                        GenericObjectPool.WHEN_EXHAUSTED_BLOCK, 2000, 10);

        ConnectionFactory connectionFactory = new DriverManagerConnectionFactory
(url, null);

        PoolableConnectionFactory poolableConnectionFactory = new 
PoolableConnectionFactory(connectionFactory, connectionPool, null, null, false, 
true);
        PoolingDriver driver = new PoolingDriver();
        driver.registerPool("example", connectionPool);
    }

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message