ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 陈抒 <csfreeb...@gmail.com>
Subject Re: How to correct the time out problem?
Date Wed, 12 May 2010 12:18:18 GMT
Hello:
Thanks a lot!
I am worrying about the overhead,because I don't know what iBatis3 will do
when I enable poolPingQuery.
I will try your idea soon.Thanks again!


陈抒
Best regards
http://blog.csdn.net/sheismylife


2010/5/12 François Schiettecatte <fschiettecatte@gmail.com>

> 陈抒
>
> Not sure which RDBMS you are using. Ideally you want to set the idle
> connection timeout in your pool to a value smaller than the idle connection
> timeout on the server end, the errors you were seeing suggests that the
> server has dropped the connection while the pool thinks it is still ok. From
> my limited experience 'autoReconnect=true' is not recommended, here is an
> excerpt from the MySQL documentation:
>
> ----
> Should the driver try to re-establish stale and/or dead connections? If
> enabled the driver will throw an exception for a queries issued on a stale
> or dead connection, which belong to the current transaction, but will
> attempt reconnect before the next query issued on the connection in a new
> transaction. The use of this feature is not recommended, because it has side
> effects related to session state and data consistency when applications
> don't handle SQLExceptions properly, and is only designed to be used when
> you are unable to configure your application to handle SQLExceptions
> resulting from dead and stale connections properly. Alternatively,
> investigate setting the MySQL server variable "wait_timeout" to some high
> value rather than the default of 8 hours.
> ----
>
> What you are doing will work but there is overhead associated with it, and
> you might want use a query like 'select 1' rather than hitting the jobstatus
> table. And you might want to read up on 'poolPingConnectionsNotUsedFor' on
> page 20 of the documentation, the default value is 0 which means the
> connection is pinged before every use.
>
> I would recommend you check into these parameters to see if you can do away
> with the ping query:
>
>                <property name="poolMaximumActiveConnections" value="10" />
>                <property name="poolMaximumIdleConnections" value="5" />
>                <property name="poolMaximumCheckoutTime" value="20000" />
>                <property name="poolTimeToWait" value="20000" />
>
> Cheers
>
> François
>
> On May 12, 2010, at 6:57 AM, 陈抒 wrote:
>
> > I don't know.
> > But I took one hour to test my application again,it works fine if the
> 'time out' problem doesn't occurs.
> > Now I add two properties,let's wait and see if it can solve this or not.
> > <property name="poolPingQuery" value="select * from jobstatus"/>
> > <property name="poolPingEnabled" value="true"/>
> >
> > 陈抒
> > Best regards
> > http://blog.csdn.net/sheismylife
> >
> >
> > On Wed, May 12, 2010 at 6:46 PM, Martin Ellis <martin@ellis.name> wrote:
> > On 12 May 2010 02:31, 陈抒 <csfreebird@gmail.com> wrote:
> > > Caused by: java.lang.NullPointerException
> > >         at freebird.business.Email.getReceiverList(Email.java:105)
> >
> > What caused this NullPointerException?
> > Is it really related to the connection option?
> >
> > Martin
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> > For additional commands, e-mail: user-java-help@ibatis.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

Mime
View raw message