Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

urgently Required connection problem

 
Reddy B.K
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks in Advance
Actually i am having the problem with the connections, the problem is even though i am closing the connection in finally block some connections are not getting closed.

i am using JSP,DB2,WebSphere
the code is in my session bean
can any one can say why the connections are not getting closed even though i am explecitely closing before exiting the the function.
the code is as below
public class XXXXX implements avax.ejb.SessionBean{
Connection conn = null;
private javax.sql.DataSource ds = null;
public XXXXX() {
try {
CHomeFactory hmfFactory = CHomeFactory.getHomeFactory();
ds = (DataSource) hmfFactory.lookup(DataSource.class, IJNDINames.DATA_SOURCE);
} catch(Exception e) {
CLogger.log("YYYYY", "constructor", e,
"An exception occurred while looking up for DataSource.", CLogger.ERROR);
}
}
public Vector YYYYY() {
try{
conn = ds.getConnection();
conn.setAutoCommit(false);
--------
---------
---------
}catch(Exception e) {
CLogger.log("-----",CLogger.ERROR)
}finally{
try{
if (conn != null) conn.close();
}catch(Exception e) {
CLogger.log("-----",CLogger.ERROR)
}
}
}

thanks
Reddy B.K
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic