初学调用数据库的问题?

jspguoyy 2001-06-14 10:34:00
<%@ page language="java" import="java.sql.*,java.util.*"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>

<body>

<%!String url;
String count;
int i=0;
%>
<%
/*int name[];
for (int i=0;i<9;i++){
name[i]=i;
}*/
out.print ("打印当前行的值。");
url = "jdbc:odbc:yingzha";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection(url,"guoyy","guoyy");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select * from t_yzxx");
while (rs.next())
count = rs.getString(1)
i++;

%>

</body>
</html>

Location: /guoyy2.jsp
Internal Servlet Error:

org.apache.jasper.JasperException: Unable to compile class for JSPE:\jakarta-tomcat\work\localhost_8080\_0002fguoyy_00032_0002ejspguoyy2_jsp_7.java:81: ?????
count = rs.getString(1)
^
E:\jakarta-tomcat\work\localhost_8080\_0002fguoyy_00032_0002ejspguoyy2_jsp_7.java:81: ????????
count = rs.getString(1)
^
E:\jakarta-tomcat\work\localhost_8080\_0002fguoyy_00032_0002ejspguoyy2_jsp_7.java:82: ?????
i++;
^
3 ???

at org.apache.jasper.compiler.Compiler.compile(Compiler.java:247)
at org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:413)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:149)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:161)
at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:160)
at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
at java.lang.Thread.run(Thread.java:484)

...全文
23 点赞 收藏 2
写回复
2 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
while (rs.next()) {
count = rs.getString(1) ;
i++;
}
回复
beyondii 2001-06-14
呵呵,同意楼上的!佩服
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2001-06-14 10:34
社区公告
暂无公告