Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.sql cursor!!!

843836Mar 15 2004 — edited Mar 15 2004
<P>
<%@ page import = "java.sql.*" %>
<%@ page import = "java.util.*" %>

<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:grocery","","");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT CustId, CustName, CustPw FROM Customer");

String inptId = request.getParameter("tid");
String inptPw = request.getParameter("tpw");

while (rs.next())
{
String dbId = rs.getString("CustId");
String dbName = rs.getString("CustName");
String dbPw = rs.getString("CustPw");

if(inptId.equalsIgnoreCase(dbId) && inptPw.equalsIgnoreCase(dbPw))
{
session.attribute("id", dbId);
session.attribute("name", dbName);
response.sendRedirect("welcome.jsp");
}
else
{
response.sendRedirect("loginpage.jsp");
}
}
%>
________________________________________________
i seem to have a problem with the cursor state. cannot target the row of data when it hits match for the if case... any suggestions?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 12 2004
Added on Mar 15 2004
1 comment
102 views