When I run the jsp page below, and then look at the Oracle cursor count  with:

select * form v$sysstat where name='opened cursors current'

I see the cursor count jump, and linger long after the page has finished loading. Eventually the count
drops, BUT I would like to know WHY the cursor count does not drop immediately after giving the rs.close
and stmt.close ???

I am using orion server with connection pooling, and oracle 8.1.6....



<%@ page language="java" import="java.sql.*" %>
<jsp:useBean id="MACHINE" class="m" scope="page"/>
<jsp:setProperty name="MACHINE" property="*"/>
<% MACHINE.fetchMachines(); %>

<html>
<body>

<TABLE>
<TR>
<TD>CODE</TD>
<TD>NAME</TD>
<TD>GROUP_ID</TD>
</TR>
<% while (MACHINE.fetchRow()){ %>
<TR>
<TD><a href="displayFormMACHINE.jsp?CODE=<%=MACHINE.getCODE()%>"> <%=MACHINE.getCODE()%></a></TD>
<TD> <%=MACHINE.getNAME()%></TD>
<TD> <%=MACHINE.getGROUP_ID()%></TD>
</TR>
<% };
%>
</TABLE>
</BODY>
</HTML>
<@ include file="bot.html"; %>


========================================================
========================================================

import java.util.*;
import java.sql.*;

public class m extends sqlForm {

private Statement stmt=null;
private ResultSet rs;
private String CODE="";
private String NAME="";
private String GROUP_ID="";

public void cleanup() throws Exception {
takeDown() };


public m() throws Exception {
makeConnection();
rs=null;
CODE="";
NAME="";
GROUP_ID="";
}


public String getCODE()
    {
      return CODE;
    }

public String getNAME()
    {
      return NAME;
    }

public String getGROUP_ID()
    {
      return GROUP_ID;
    }


public void setCODE( String  CODE_set)
    {
  if (CODE_set == null) CODE=""; else CODE=CODE_set.trim();
    }

public void setNAME( String  NAME_set)
    {
  if (NAME_set == null) NAME=""; else NAME=NAME_set.trim();
    }

public void setGROUP_ID( String  GROUP_ID_set)
    {
  if (GROUP_ID_set == null) GROUP_ID=""; else GROUP_ID=GROUP_ID_set.trim();
    }


public int fetchMachines()
throws Exception
   {
    stmt = myConn.createStatement();
rs=stmt.executeQuery( "SELECT * FROM MACHINE ORDER BY CODE");
return 0;};



public boolean fetchRow()
throws Exception
   {
if (rs.next()) {
setCODE( (String) rs.getString("CODE"));
setNAME( (String) rs.getString("NAME"));
setGROUP_ID( (String) rs.getString("GROUP_ID"));
rs.close();
stmt.close();
takeDown();
}
return false;
}


};


========================================================
========================================================

import java.sql.*;
import java.io.*;
import javax.sql.DataSource;
import javax.naming.InitialContext;

public abstract class sqlForm
{
 private String myDriver = "oracle.jdbc.driver.OracleDriver";

 protected Connection myConn;
 
 public sqlForm() {}

 public void makeConnection() throws  Exception
 {
  InitialContext ctx = new InitialContext();
  DataSource ds = (DataSource) ctx.lookup("jdbc/ccfopDS");
  myConn = ds.getConnection();
  System.out.println("Connection made:-->ccfop " + myConn);
 }

 public abstract void cleanup() throws Exception;
 



 public void takeDown() throws Exception
 {
  System.out.println("DB connection closed");
  myConn.close();
 }
 
}

Reply via email to