Hello all,

I'm trying to get the connection pool example to work from the FAQ using the
JSP 1.0 spec with the JWS that comes with it.  This references the following
URL....
http://webdevelopersjournal.com/columns/connection_pool.html


The compilation error I'm getting from dbconn.jsp (shown below)
follows....Obviously, it's not recognizing the declaration between the
script tags....Why?  Any help would be much appreciated....(i.e. I tried
moving this declaration down a line or two (with comments) and removed the
script tags but this failed as well saying that it couldn't find the
appropriate class....(examples.jsp.dbconn.DBConnectionManager).  This,
however, is in the classpath of startserver.bat...Why is this class not
found?
Startserver.bat
if "%CLASSPATH%" == "" goto noclasspath

rem else
set _CLASSPATH=%CLASSPATH%
set
CLASSPATH=server.jar;servlet.jar;classes;examples\jsp\dbconn;examples\WEB-IN
F\jsp\beans;d:\jdk1.2.1\lib\tools.jar;rodv\WEB-INF\jsp\beans%CLASSPATH%
goto next

Compilation Errors
work\%3A8080%2Fexamples\dbconnpool_jsp_1.java:36: Undefined variable or
class na
me: connMgr
            Connection con = connMgr.getConnection("freetds");
                             ^
work\%3A8080%2Fexamples\dbconnpool_jsp_1.java:52: Undefined variable or
class na
me: connMgr
              connMgr.freeConnection("freetds", con);
              ^

dbconn.jsp
<%@ page import = "java.sql.*" %>


< script RUNAT="SERVER">
DBConnectionManager connMgr = DBConnectionManager.getInstance();
</script>

Done with connection...
<%
/*DBConnectionManager connMgr = DBConnectionManager.getInstance();*/
Connection con = connMgr.getConnection("freetds");

if (con == null) {
  out.println("Can't get connection");
  return;
  }

try {
  Statement stmt = con.createStatement();
  ResultSet rs = stmt.executeQuery ("SELECT ses_remote_addr  FROM
sessions");
  while(rs.next()) {
        out.println(rs.getString("ses_remote_addr"));
  }
  stmt.close();
  rs.close();
  }catch (SQLException e) {e.printStackTrace(out);}
  connMgr.freeConnection("freetds", con);

%>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to