commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Schalk" <sch...@volume4.co.za>
Subject RE: DBCP question: what is closing the actual database connection ?
Date Sun, 09 Nov 2003 01:56:15 GMT
John

In basic situation you will have:
Class.forName(DRIVER);
con = DriverManager.getConnection(URL,USER,PASS);

At the end you will have:
finally {
    try {	
    if (con != null)
        con.close();
	} catch (SQLException ex) {
            out.println("\nERROR:------ SQLException -----\n");
            out.println("Message: " + ex.getMessage());
            out.println("SQLState: " + ex.getSQLState());
            out.println("ErrorCode :" + ex.getErrorCode());
        }
            }

You may want to check the doc for the dbPool you use to get the method for
doing this.

Kind Regards
Schalk Neethling
Web Developer.Designer.Programmer.CEO
Volume4.Development.Multimedia.Branding
emotionalize.conceptualize.visualize.realize
Tel: +27125468436
Fax: +27125468436
email:schalk@volume4.co.za
web: www.volume4.co.za
 
This message contains information that is considered to be sensitive or
confidential and may not be forwarded or diclosed to any other party without
the permission of the sender. If you received this message in error, please
notify me immediately so that I can correct and delete the original email.
Thank you. 

:: -----Original Message-----
:: From: John Zoetebier [mailto:john.zoetebier@transparent.co.nz]
:: Sent: Sunday, November 09, 2003 3:41 AM
:: To: commons-user@jakarta.apache.org
:: Subject: DBCP question: what is closing the actual database connection ?
:: 
:: I have DBCP example code ManualPoolingDriverExample working just fine.
:: To test if the connection is indeed pooled I made a loop which opens and
:: closes the connection.
:: The first connection takes about 2500 ms.
:: Next connections take 1 ms.
:: This looks pretty good to me.
:: 
:: My worry though is what happens if I shutdown the application.
:: What is actually closing down the real database connection stored in the
:: DBCP pool ?
:: Do I have to call a method to indicate that the program is shuttinf down
?
:: 
:: --
:: John Zoetebier
:: Web site: http://www.transparent.co.nz
:: 
:: ---------------------------------------------------------------------
:: To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
:: For additional commands, e-mail: commons-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message