这是我的登录页面的代码,我收到错误::
<%
String uid=request.getParameter("t1");
String pwd=request.getParameter("t2");
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","Sindhu","project");
PreparedStatement pst=con.prepareStatement("select * from Shield where user_id=?",ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
pst.setString(1,uid);
ResultSet rs=pst.executeQuery();
String master=rs.getString(5);
if(master.equals(pwd))
{
session.putValue("userid",uid);
%>
-----------html code
<%
PreparedStatement pst1=con.prepareStatement("select * from "+uid+"",ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
ResultSet rset=pst1.executeQuery();
while(rset.next())
{
String sitename=rset.getString(1);
String username=rset.getString(2);
String password=rset.getString(3);
String url1=rset.getString(4);
%>
------html code
<%
}
rset.close();
pst1.close();
%>
----html code
<%
}
else
{
%>
----html code
<%
}
rs.close();
pst.close();
con.close();
}
catch(Exception e)
{
out.println(" "+e);
}
%>
以下是Oracle中的表创建语法:
CREATE TABLE Shield
(
f_name varchar2(40),
user_id varchar2(40) PRIMARY KEY,
email varchar2(40),
phone Number(11),
pass_id varchar2(40),
face varchar2(40),
finger varchar2(40)
);
我正在使用TOMCAT并且我得到一个异常:java.sql.SQLException:Exhausted Resultset
我甚至尝试使用uid名称在oracle中手动插入几行。所以,rs不会是空的。
提前谢谢, 娜斯迪胡