Regards Scott
On 14/09/2009, at 2:55 PM, Jack Liu wrote:
In the close method of class SQLProcessor, the variable _connection is absolutely an instance of java.sql.Connection not PoolableConnection.-----Original Message----- From: Scott Gray [mailto:scott.g...@hotwaxmedia.com] Sent: 2009年9月14日 10:44 To: user@ofbiz.apache.org Subject: Re: Do we need to manually close SQLProcesser? No the connection implementation is a PoolableConnection and closing it returns it to the pool, if you don't close it then it won't be returned until the SQLProcessor is finalized at which point it closes the connection itself. Just to reiterate in case it isn't clear, you should always call SQLProcessor.close() when you are done with it. Regards Scott On 14/09/2009, at 2:30 PM, Jack Liu wrote:Hi, LarryFrom the constructor of class SQLProcesser, there is no need toclose it manually./*** Construct an object with an connection given. The connectionwill not* be closed by this SQLProcessor, but may be by some other.** @param helperName The datasource helper (see entityengine.xml<datasource name="..">)* @param connection The connection to be used*/public SQLProcessor(String helperName, Connection connection) {this.helperName = helperName;this._connection = connection;// Do not commit while closingif (_connection != null) {_manualTX = false;}}And the close method closes the true connection, not a proxy orsomething else,So if you close it by yourself, the pool will be run out.-----Original Message-----From: Larry.Liu [mailto:xiangqian....@wizitsoft.com]Sent: 2009年9月14日 9:45To: user@ofbiz.apache.orgSubject: Re: Do we need to manually close SQLProcesser?Hi Gray,Thanks for your help,So according to my understanding, trying to close the SQLProcessorwillcause available connection in the pool fewer and fewer and therewill be "NoManagedConnections Available!" exception in the end, isn't it?Now we have a B2C website running on ofbiz, using Database mysql5.0we only have about 2000 visitors one day, we have set the max mysqlconnection to 150, in my assumption, that is enough, but it keeps onthrowing the error"No ManagedConnections Available!" every one or two days,So there could be the problem of1. Ofbiz out-of-the-box code leads to the connection leakage2. Customization code leads to the connection leakage.Obviously we thought the problem is in our customized code, andSQLProcessoris the only part where we use the connections directly. so that'swhy I amasking the question in the first mail.But it seems this is not the problem.Hope somebody can share more information about this "NoManagedConnectionsAvailable!" information, thanks.Thanks.Regards,Liu XiangqianWizitsoft Information Technology Ltd.www.wizitsoft.com | (86) 010-62670653 ext 614On Fri, Sep 11, 2009 at 10:58 AM, Scott Gray <scott.g...@hotwaxmedia.comwrote:Hi Liu,Yes you should call close() on the SQLProcessor and no closing theconnection will not prevent it from being returned to the pool.Whether itwill solve your problem or not I don't know.RegardsScottHotWax Mediahttp://www.hotwaxmedia.comOn 11/09/2009, at 2:44 PM, Larry.Liu wrote:Hi,We have created SQLProcessor in our code manually and also invokeprocess.close()after execute the sql query or update, and we are assumpting thiscausederror ofNo ManagedConnections AvailableI have looked into the file EntitySQLProcessor.bsh, that's thefile forwebtools module SQL Processor page, I didn't see any closure of theSQLProcessor.So here are two questions,1. Do we need to manually close the SQLProcessor?2. Close one SQLProcessor instance will cause the connectionattached tothis process being closed and make available connections in thepool fewerand fewer?Thanks.Regards,Liu XiangqianWizitsoft Information Technology Ltd.www.wizitsoft.com | (86) 010-62670653 ext 614
smime.p7s
Description: S/MIME cryptographic signature