Mike,
Yes I am returning the connection to the pool after
closing the ps. As you can see in the jsp code that I
have attached earlier to Craig, I am closing the
preparedstatement then returning the instance. Here
again the snippet.
%>
</table>
</body>
</html>
<%}
ps.close();
thisManager.returnConnection(myConn);
/* End Log user access count to the system */
}%>
--- Mike Jackson <[EMAIL PROTECTED]> wrote:
> You might want to close your database connection, or
> at least return it to
> the pool (I don't see you doing that, it ought to be
> after you close the
> prepared statement).
>
> --mikej
> -=-----
> mike jackson
> [EMAIL PROTECTED]
>
> > -----Original Message-----
> > From: Luminous Heart
> [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, August 19, 2002 8:36 AM
> > To: Tomcat Users List
> > Subject: Re: It would be great IF somebody
> answered me, ONCE, for change
> > :(
> >
> >
> > Hi Graig,
> > Here is my jsp file. I am not sure what might be
> > wrong. Although the same error happens in a bigger
> > application in a tc cluster of 3 tomcats. Two of
> these
> > tcs fail while one does not get any forwards after
> > that.
> >
> > Please take a look at my code, if you do not mind.
> >
> > Best regards.
> >
> > ===================== JSP =====================
> > <%@ page import="java.io.*" %>
> > <%@ page import="java.util.*" %>
> > <%@ page import="java.text.*" %>
> >
> > <%@ page import="java.util.Properties" %>
> > <%@ page import="java.util.Date" %>
> >
> > <%@ page contentType="text/html"%>
> >
> > <%@ page import="com.codestudio.util.*"%>
> > <%@ page import="java.sql.*"%>
> >
> > <!-- %@ include file="no-cache.jsp" % -->
> >
> > <form action="UserAccount.jsp" method=post
> > name="access_form">
> > <table width="90%" align="center">
> > <tr>
> > <th bgcolor="#CCCCFF" colspan=3>
> <font
> > size=5>User Access</font></th>
> >
> > <td> </td>
> > <td> </td>
> > <td> </td>
> > </tr>
> > <tr>
> > <td>
> > <center>
> > <table cellpadding=4 cellspacing=2
> border=0>
> > <th bgcolor="#CCCCFF" colspan=2> <font
> > size=5>User Access by userid</font></th>
> > <tr bgcolor="#c8d8f8">
> > <td valign=top colspan=2> <b>User
> > Name</b><br>
> > <input type="text"
> name="byusername"
> > size=25 value="" maxlength=25>
> > </td>
> > </tr>
> > </table>
> > </center>
> > </td>
> > <td>
> > <center>
> > <table cellpadding=4 cellspacing=2
> border=0>
> > <th bgcolor="#CCCCFF" colspan=2> <font
> > size=5>User Access by Date</font><font
> size=1></font>
> > </th>
> > <tr bgcolor="#c8d8f8">
> > <td valign=top> <b>Date</b><br>
> > <input type="text" name="bydate"
> > value="" size=25 maxlength=125>
> > <br>
> > </td>
> > </tr>
> > </table>
> > </center>
> > </td>
> > <td>
> > <center>
> > <table cellpadding=4 cellspacing=2
> border=0>
> > <th bgcolor="#CCCCFF" colspan=2> <font
> > size=5>USER Access by IP Address</font>
> > </th>
> > <tr bgcolor="#c8d8f8">
> > <td valign=top> <b>IP
> Address</b><br>
> > <input type="text"
> name="byipaddress"
> > value="" size=25 maxlength=125>
> > <br>
> > </td>
> > </tr>
> > </table>
> > </center>
> > </td>
> > </tr>
> > <tr>
> > <td> </td>
> > <td align="center" bgcolor="#c8d8f8">
> > <input type="submit" value="Submit"
> > name="submit">
> > </td>
> > <td> </td>
> > </tr>
> > </table>
> > </form>
> > <%
> > String inUser = null;
> > String inDate = null;
> > String inIPadd = null;
> >
> > try{
> > inUser =
> > (request.getParameter("byusername")).trim();
> > if (inUser == null) inUser = "";
> > inDate =
> request.getParameter("bydate").trim();
> > if (inDate == null) inDate = "";
> > inIPadd =
> > request.getParameter("byipaddress").trim();
> > if (inIPadd == null) inIPadd = "";
> >
> > }catch(NullPointerException npe){
> > out.println("Please choose a query option.");
> >
> > }
> >
> > PreparedStatement ps = null;
> > /* Log user access count to the system */
> >
> > SQLManager thisManager = null;
> > if (thisManager == null)
> > thisManager = SQLManager.getInstance();
> >
> > Connection myConn = null;
> >
> > if (myConn == null)
> > myConn = thisManager.requestConnection();
> > if (((inUser != null) && !inUser.equals("") ) ||
> > ((inDate != null) && !inDate.equals("")) ||
> ((inIPadd
> > != null) && !inIPadd.equals("")))
> > {
> >
> > java.util.Date today = new
> java.util.Date();
> > java.sql.Timestamp stamp = new
> > java.sql.Timestamp(today.getTime());
> >
> > String stampStr = stamp.toString();
> >
> > String timeofday =
> > stampStr.substring(11,stampStr.length());
> > String date = stampStr.substring(0,11);
> >
> > String todayatZero = date + "
> 00:00:00.0000";
> >
> > todayatZero = "2002-08-01 00:00:00.0000";
> >
> > inDate += " 00:00:00.0000";
> >
> > boolean ValueEntered = false;
> > if (((inUser != null)&& (inDate != null) &&
> (inIPadd
> > != null)) && (!inUser.equals("") &&
> !inDate.equals("")
> > && !inIPadd.equals("")) )
> > {
> > //out.println("all are not empty and not null!");
> > ps = myConn.prepareStatement ("select * from
> > DataBaseTableName where username = ? and
> useripaddress
> > = ? and timestamp >= ? order by timestamp desc");
> > ps.setString(1, inUser);
> > ps.setString(2, inIPadd);
> > ps.setString(3, inDate);
> > ValueEntered = true;
> >
> > }else{
> > if ((inUser != null)&& (!inUser.equals("")))
>
=== message truncated ===
__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>