ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vamsee Kanakala <vamli...@gmail.com>
Subject Re: Connections
Date Fri, 07 Jan 2005 04:54:52 GMT
Carl Brodeur wrote:

>Would like to know how Ibatis releases or close its connections.  I use 
>a JNDI datasource type (connection pool).  I look at the debug trace, 
>see when connection are requested but not when they are released.
>
>  
>
I have a similar problem. I am using sqlmaps only, and I'm getting the 
datasource connection from the container itself, like this:

public class BatsSqlConfig {
    private static final SqlMapClient sqlMap;
   
    static {
        try {
            String resource = "com/mafoi/bats/sql-map-config.xml";
            Reader reader = Resources.getResourceAsReader(resource);
            sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
        } catch (Exception e){
            e.printStackTrace();
            throw new RuntimeException("Init error: BatsSqlConfig class. 
cause: " + e);
        }
    }
   
    public static SqlMapClient getSqlMapInstance() {
        return sqlMap;
    }
}

And, I'm using the code like this:

public class LoginBean {

 
    SqlMapClient sqlMap;
      
    public LoginBean() {
        sqlMap = BatsSqlConfig.getSqlMapInstance();
    }

    public User getUser(String userName, String password) throws 
SQLException {       

        return (User)sqlMap.queryForObject("getUser", 
userName);                               
    }
}

But, I'm using Tomcat Ant tasks to stop and start the container. I get 
the feeling that the connections are not closed, because 2 developer 
machines (linux) just hung after doing a few start/stops of the 
application inside Tomcat. It never happened before, while we used to 
shutdown tomcat fully before deploying the application again. How can I 
make sure that the PoolableConnection objects are actually released 
before I restart the application in Tomcat?

TIA,
Vamsee.

Mime
View raw message