Dear Hu Jeff,
Thanks, that solves it.
Mike,
Your have to close your resuletset rest1.
-----Original Message-----
From: mike dell [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 08, 2000 4:36 PM
To: [EMAIL PROTECTED]
Subject: Tomcat crash
Hi all,
The code listed links to the database and adds a new
row. The first time I run this page works fine. When I
refresh the browser and try to to add another row,
tomcat crashes.
Would you please tell me what is wring in my code. I
am a beginner in JSP though.
Thanks in advance
----------------------------
<html>
<head>
<title>
Add new row
</title>
</head>
<%@ page language="java" import="java.sql.*,
java.util.*, java.net.URL" %>
<body>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection myConn =
DriverManager.getConnection("jdbc:odbc:EDMP");
int rowsAffected = 0;
int found = 0; file://not
found
String last = request.getParameter("last_name");
String first = request.getParameter("first_name");
String middle = request.getParameter("middle_name");
String login = request.getParameter("loginID");
String passwd = request.getParameter("password");
String queryString1 = "SELECT
LAST_NAME,FIRST_NAME,LOGIN FROM PERSON_INFO";
Statement stmt1 = myConn.createStatement();
ResultSet res1 = stmt1.executeQuery (queryString1);
while (res1.next()) {
if (last.compareTo(res1.getString(1))==0 &&
first.compareTo(res1.getString(2))==0)
if (login.compareTo(res1.getString(3))==0)
{
found = 1;
%>
<center><h1>Sorry, this login ID already
exists.</h1></center>
<%
break;
}
}
if(found == 0)
{
ins_info = "insert into PERSON_INFO
(LAST_NAME,FIRST_NAME,MIDDLE_NAME,LOGIN,PASSWORD)
values('" + last +"','" + first + "','" + middle +
"','" + login + "','" + passwd + "')";
PreparedStatement stmt3 =
myConn.prepareStatement(ins_info);
rowsAffected = stmt3.executeUpdate();
}
if (rowsAffected == 1)
{
%>
<center><h1>The new user ID created
Successfully</h1></center>
<%
}
else{
stmt1.close();
myConn.close();
%>
</body>
</html>
-----------------------------
__________________________________________________
Do You Yahoo!?
Kick off your party with Yahoo! Invites.
http://invites.yahoo.com/
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with
body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with
body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
__________________________________________________
Do You Yahoo!?
Kick off your party with Yahoo! Invites.
http://invites.yahoo.com/
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets