tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Propes, Barry L " <barry.l.pro...@citi.com>
Subject RE: DBCP abandoned trace - unable to understand the leak
Date Thu, 04 Nov 2010 15:37:25 GMT
Not sure if it matters or not, but in your   SponserSummaryDAO method, it appears you establish
the rs as null, but don't ever close it? You might specifically try that.

And is it necessary to reassign all those variables (connection, rs, pstmt) to null again
in those catch blocks?


-----Original Message-----
From: sasidhar prabhakar [mailto:sasidhar1229@gmail.com]
Sent: Thursday, November 04, 2010 7:05 AM
To: Tomcat Users List
Subject: Re: DBCP abandoned trace - unable to understand the leak

*
* @author oracle
*/
public class SponserSummaryDAO {
...


public SponserSummaryDAO(){
log.info("^^^^^Cretion of SponserSummaryDAO :
"+Calendar.getInstance().getTime().toString());
dataSource = ConnectionUtil.getDataSource(); }

public void updateClicks(int sid){
Connection connection = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try{
connection = dataSource.getConnection();

pstmt = connection.prepareStatement(updateClicksQuery);
pstmt.setInt(1, sid );
int updated = pstmt.executeUpdate();
log.info(" sponser clicks updated val : "+updated); }catch(Exception ex){ ex.printStackTrace();
log.error(ex.getMessage()); }finally{ try {if( pstmt != null)pstmt.close();} catch (SQLException
ex) {ex.printStackTrace();} try {if( connection != null)connection.close();} catch (SQLException
ex) {ex.printStackTrace();} connection = null; pstmt = null; } }

}

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message