ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Begin <clinton.be...@gmail.com>
Subject Re: iBatis Connection Management
Date Mon, 06 Dec 2004 14:18:46 GMT
Hi Peter,

I've never experienced this, nor have I heard of anything similar.
Which datasource implementation are you using: SimpleDataSource, or
DBCP?

In either case I'd expect it to work.  Make sure though that you've
properly ended your transaction within a finally block.  For example:

try {
   sqlMapClient.startTransaction();
   //  ... do some work
   sqlMapClient.commitTransaction();
} finally {
   sqlMapClient.endTransaction();
}

Cheers,
Clinton


On Mon, 06 Dec 2004 11:19:44 +0000, Peter Bracken <bracken@corksurf.com> wrote:
> Hi,
> 
> I've recently started using iBatis for one of my projects and I like it
> but I'm having problems with the database connection.
> By default the database stops returning results after 122 queries, after
> that I get the following exception:
> 
> [6/12/2004 9:40:14] [Error getting latest messages: Server configuration
> denies access to data source]
> java.sql.SQLException: Server configuration denies access to data source
>         at com.mysql.jdbc.MysqlIO.init(Unknown Source)
>         at com.mysql.jdbc.Connection.connectionInit(Unknown Source)
>         at com.mysql.jdbc.jdbc2.Connection.connectionInit(Unknown Source)
>         at com.mysql.jdbc.Driver.connect(Unknown Source)
>         at java.sql.DriverManager.getConnection(DriverManager.java:512)
>         at java.sql.DriverManager.getConnection(DriverManager.java:171)
>         at
> com.ibatis.common.jdbc.SimpleDataSource.popConnection(SimpleDataSource.java:572)
>         at
> com.ibatis.common.jdbc.SimpleDataSource.getConnection(SimpleDataSource.java:215)
>         at
> com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.init(JdbcTransaction.java:45)
>         at
> com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.getConnection(JdbcTransaction.java:78)
>         at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.java:118)
>         at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:626)
>         at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:598)
>         at
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:107)
>         at
> com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:76)
>         at
> com.corksurf.chatterbox.ChatterBoxManager.getLatestMessages(ChatterBoxManager.java:106)
> 
> It's a web-app so I thought maybe reloading the Context might do
> something but no. I need to restart Tomcat to be able to run a query again.
> I changed some values in the config.xml file for pooling:
>          <property name="Pool.MaximumActiveConnections" value="10"/>
>          <property name="Pool.MaximumIdleConnections" value="3"/>
>          <property name="Pool.MaximumCheckoutTime" value="120000"/>
>          <property name="Pool.TimeToWait" value="10000"/>
> Now I get the exceptions after around a hundred queries.
> 
> It seems to work fine if I use a JNDI resource, which I will be doing in
> my app.
> I noticed this problem because I didn't have my Unit Tests configured to
> use the JNDI resource.
> 
> Is it a known issue? Or is it something wrong with my config?
> 
> Thanks
> 
> Peter Bracken
> 
>

Mime
View raw message