陈抒 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 <mar...@ellis.name> wrote: > On 12 May 2010 02:31, 陈抒 <csfreeb...@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-unsubscr...@ibatis.apache.org > For additional commands, e-mail: user-java-h...@ibatis.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org