ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Filipe David Manana" <fdman...@ieee.org>
Subject iBATIS querying pattern for web applications
Date Tue, 27 May 2008 14:09:52 GMT
Hello,

I am developing a webapp and using iBATIS for the first time. I configured
iBATIS to use a JDBC transaction manager and a JNDI datasource, provided by
Tomcat+DBCP. When my webapp is deployed, a Servlet executes and initializes
iBATIS :

      SqlMapClient sqlMap = null;
      Reader reader = null;

      try
      {
         reader = Resources.getResourceAsReader(configFile);
      }
      catch( Exception ex )
      {
         String error = "Could not get Reader for iBATIS config file: " +
ex;
         log.fatal(error);

         throw new DatabaseException(error);
      }

      try
      {
         sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
      }
      catch( Exception ex )
      {
         String error = "Could not create iBATIS SqlMapClient object: " +
ex;
         log.fatal(error);

         throw new DatabaseException(error);
      }


This initialization is done only once. For each http request, I use the
sqlMap object to get a new session, execute select queries (through
queryForList method) and close the session. The pattern is like this:

      SqlMapSession session = sqlMap.openSession();
      List list = null;

      list = (List) session.queryForList("queryId");
      session.close();

Although I frequently get the SQLException :

    java.sql.SQLException: ORA-02391: exceeded simultaneous
SESSIONS_PER_USER limit

Am I doing something wrong? I am the only user. My Tomcat+DBCP configuration
is supposedly ok, as it is the same I used for another application (using
Hibernate and same Database Server). It seems to me that iBATIS is somehow
not releasing the DB connections.
I am using iBATIS 2.3.0

cheers

-- 
Filipe David Manana,
fdmanana@ieee.org

"First they ignore you, then they laugh at you, then they fight you, then
you win."

Mime
View raw message