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]

Reply via email to