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: how to close the connection in iBATIS explicitly ?
Date Tue, 12 Feb 2008 16:23:41 GMT
Even in the case of an error, iBATIS should release the connection if you're
using the right transaction pattern.

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

Ensure that you're using that pattern everywhere you use explicitly
demarcated transactions with iBATIS.  The try/finally block is critical.

Another problem might be that your container is expiring connections that
haven't been used in a while.  If that's the case, try configuring the ping
query to check for connection validity before it attempts to use them.

My only other question would be, why are insert/update errors so common in
your application?

Clinton




-----Original Message-----
From: manypoints [mailto:manypoints@yahoo.com] 
Sent: February-12-08 8:50 AM
To: user-java@ibatis.apache.org
Subject: how to close the connection in iBATIS explicitly ?


Sometimes my application is giving some database insert/update error and
still dbconnection is holded by the process. Because of this other process
are running out of connections. Is anyone know how to close the connection
in iBATIS explicitly ? 

Help appreciated.

-- 
View this message in context:
http://www.nabble.com/how-to-close-the-connection-in-iBATIS-explicitly---tp1
5434498p15434498.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Mime
View raw message