connection.isClosed() should return a boolean telling you whether or not
the connection was released.

On Sat, 2005-07-23 at 14:18 -0700, Tony Smith wrote:
> I think this is a classic java question: Pass by
> reference or by value. I have a DatabaseManager class
> which takes care of get conection from connection pool
> and release the connectoin. I am not sure about the
> release part. Here is my code:
> 
> class MyMainClass
> 
> public static final void main(String[] args){
> 
>     Connection connection =
> DatabaseManager.getConnection();
> 
>     ....//jdbc work.
> 
>    DatabaseManager.closeConnection(connection);
> ...
> }
> 
> 
> public class DatabaseManager {
>  
>     public static Connection getConnection(){
>         Connection connection =
> getConectionFromDataSource();
> 
>        return connection;
>     }
>     
>     public static void closeConnection(Connection
> conn){
>       if (conn != null){
>               try{
>                       conn.close();
>               }catch(SQLException sqle){
>                       sqle.printStackTrace();
>               }
>       }
>       conn = null;
>     }}
> 
> 
> I am not sure if the connection is released....
> 
> 
> Thanks,
> 
> 
> 
> 
>               
> ____________________________________________________
> Start your day with Yahoo! - make it your home page 
> http://www.yahoo.com/r/hs 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to