You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2002/09/09 05:20:16 UTC

DO NOT REPLY [Bug 12409] New: - Connection can be closed twice

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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>