ORA-01000: maximum open cursors exceeded I know it but !!!!
I know why this exception is generated, but I can not go through all the code and figure out where the connections, statements and resultsets are not properly closed because I had been given a task to figure out some one else's problem and the code is composed of 736 jsp and couple of hundred servlets , so it is almost impossible to go through all the statements..
Please tell me some trick or tip by which i could fix this bug with minimum effort....
Some chunks of code are as follows...
<%
conn.ConnectDB();
ResultSet rSet =null;
String sqlQuery2 ="select * from client_configuration ";
rSet = conn.executeQ(sqlQuery2);
try{
while(rSet.next()){
%>
<tr>
<td>
<%=rSet.getString(1)%>
</td>
<td>
<%=rSet.getString(2)%>
</td>
</tr>
<%
}
}catch(SQLException ex){
System.out.println("Exception in test123.jsp"+ex);
}finally{
conn.closeStmt();
conn.CloseCon();
}
> ConnectDB()
publicvoid ConnectDB()
throws SQLException, Exception
{
rb = ResourceBundle.getBundle("HDConn.app");
String s = rb.getString("pwd");
String s1 = rb.getString("uname");
String s2 = rb.getString("ip");
String s3 = rb.getString("sid");
String dataSource = rb.getString("DataSource");
try
{
Context initialContext =new InitialContext();
// DataSource datasource = (DataSource)initialContext.lookup("jdbc/KFHD01PooledDS");
DataSource datasource = (DataSource)initialContext.lookup(dataSource);
if(conn ==null)
{
conn = datasource.getConnection();
++counter;
System.out.println("Counter = "+counter);
}
}catch(NamingException ex )
{
thrownew RuntimeException("Init: Cannot get connection " + ex);
}
}
publicsynchronized ResultSet executeQ(String s)
throws SQLException
{
Object obj =null;
ResultSet resultset =null;
try
{
if(conn.isClosed())
ConnectDB();
stmt = conn.createStatement();
resultset = stmt.executeQuery(s);
}
catch(Exception exception)
{
System.out.println(exception);
}
return resultset;
}
publicvoid CloseCon()
{
try
{
if(rset !=null)
{
rset.close();
rset =null;
}
if(!conn.isClosed())
conn.close();
}
catch(Exception exception){}
}
publicvoid closeStmt()
{
try
{
stmt.close();
}
catch(Exception exception){}
}
your help will be greatly appreciated...

