GeeCON Prague 2014*
The moose likes JDBC and the fly likes Connection Pooling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "Connection Pooling" Watch "Connection Pooling" New topic
Author

Connection Pooling

Rajendar Goud
Ranch Hand

Joined: Mar 06, 2002
Posts: 220
Hi,
iam running an application on tomcat3.22 with the following Driver .

Class.forName("com.ibm.db2.jcc.DB2Driver");

This works fine ,but i migrated the application on to tomcat4.1 and i am making use of the tomcats connection Pooling classes as follows.

try{
javax.naming.Context ctx = new javax.naming.InitialContext();
if(ctx == null )
throw new Exception("Error - No Context");
javax.sql.DataSource ds =
(javax.sql.DataSource)ctx.lookup(
"java:comp/env/jdbc/db2mccts");
//name of the database connection pool defined in the resource link for that context.

if (ds != null) {
conn = ds.getConnection();}
}catch(SQLException SQLExcept)
{
cat.error("Exception during getConnection() from the connection pool...",SQLExcept);
throw SQLExcept;
}
catch(Exception exp)
{
cat.error("Exception in creating connection using InitialContext... ",exp );
}

i face an sql exception as follows :

[cbu58190:::] ETListTableModelFactory.getETListTableModel : Error SQLException occurs...:
com.ibm.db2.jcc.c.SQLException: Invalid operation: result set closed
at com.ibm.db2.jcc.c.ca.T(ca.java:2682)
at com.ibm.db2.jcc.c.ca.wasNull(ca.java:493)
at org.apache.commons.dbcp.DelegatingResultSet.wasNull(DelegatingResultSet.java:197)
at com.db.ac.mccTracking.business.query.ETListTableModelFactory.setETListTableModel(ETListTableModelFactory.j
ava:448)
at com.db.ac.mccTracking.business.model.ETListBean.updateListData(ETListBean.java:828)
at org.apache.jsp.ETListCtrl_jsp._jspService(ETListCtrl_jsp.java:126)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:64
3)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:64
3)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:64
3)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:64
1)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:64
1)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:64
3)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:193)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)

at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:589)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:666)
at java.lang.Thread.run(Thread.java:595)


How could the code behave like this ? like to hear something on this.

Regards,
Rajendar
 
GeeCON Prague 2014
 
subject: Connection Pooling