Connection pool problem in JWSDP which is using Apache tomcat 4.0
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Thursday, October 31, 2002 02:07 AM

Hi, I have been using JWSDP which internally using Tomcat Server. I am using a recursive method to populate the data from database into JavaObject.after some point of time data is not loading,I am not sure whether the problem is due to connection in connection pooling. After 6 levels deeper the problem is Coming,Here Below i am attaching the code snippet public Container getSubContainerList(String strcontainerID,Container cont){ String sql =""; ResultSet rs=null; ResultSet rs1=null; Container[] strcont = {}; Content[] strcontent={}; Statement stmt = null; Statement stmt1 = null;    More>>

Hi,
I have been using JWSDP which internally using Tomcat Server.



I am using a recursive method to populate the data from database into JavaObject.after some point of time data is not loading,I am not sure whether the problem is due to connection in connection pooling.

After 6 levels deeper the problem is Coming,Here Below i am attaching the code snippet



public Container getSubContainerList(String strcontainerID,Container cont){


String sql ="";

ResultSet rs=null;

ResultSet rs1=null;

Container[] strcont = {};

Content[] strcontent={};

Statement stmt = null;

Statement stmt1 = null;


int count = 0;

int containercount =0;

int contentcount =0;


try{

con = dBean.getConnection();

stmt = con.createStatement();

stmt1 = con.createStatement();

// cont = getContentList
(strcontainerID,cont);// to here

sql = "select count(*) as
container_count from DCAM_Container where ParentContainer_ID ='"+strcontainerID+"'";

//rs1 = getResultset(sql);

rs1 = stmt.executeQuery(sql);

while(rs1.next()){

containercount = rs1.getInt("container_count");

}

if(containercount > 0){
strcont = new Container[containercount];

}
else{
return cont;
}

// Changed from Here



sql = "select Container_ID,Container_Name from DCAM_Container where ParentContainer_ID ='"+strcontainerID+"'";

//rs = getResultset(sql);
rs = stmt1.executeQuery(sql);

while(rs.next()){

Container cont1 = new Container();

String strcontainerID1 = rs.getString("Container_ID");

String strcontainerName = rs.getString("Container_Name");

cont1.setContainerID(strcontainerID1);

cont1.setContainerName(strcontainerName);

LogWriter.errorLog("The sub Container Name is:"+strcontainerName);

cont1 = getSubContainerList(strcontainerID1,cont1);

strcont[count] = cont1;

count++;
}

cont.setContainer(strcont);



}catch(Exception ex){

LogWriter.errorLog("The error in getSubContainerList list..");

ex.printStackTrace();
}finally{

try{

if(con != null)
con.close();

if(stmt != null)
stmt.close();

if(stmt1 != null)
stmt1.close();

if(rs != null)
rs.close();

}catch(Exception ex){}

}

return cont;



}



Thanks in advance

Kishore

   <<Less

Re: Connection pool problem in JWSDP which is using Apache tomcat 4.0

Posted By:   Masood_Jan  
Posted On:   Thursday, October 31, 2002 09:29 AM

yes it is the problem in the connection pooling.
Whats happening is the conection pool is exhausted after certain executions. Coz u r not restoring the connection in to the pool after each execution.
So after executing and reading data from the result set restore the connection before u the funtion gets recursive.
About | Sitemap | Contact