Can your query raise exception that's handled elsewhere, so that
session.close() is not called? Try this:


      SqlMapSession session = sqlMap.openSession();
      List list = null;
      try {
      list = (List) session.queryForList("queryId");
        }
       catch (Exception e)
       {
            log.....
        }
       finally {
              session.close();
       }


On Tue, May 27, 2008 at 6:09 PM, Filipe David Manana <[EMAIL PROTECTED]>
wrote:

> 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,
> [EMAIL PROTECTED]
>
> "First they ignore you, then they laugh at you, then they fight you, then
> you win."
>

Reply via email to