返回信息流JDK(jdk1.7.0_09)配置是正确的;tomcat(6.0.36)安装配置也是正确的,
mysql 5.0安装正确,
但JDBC驱动(mysql-connector-java-5.1.7-bin)的安装不一定正确(这个究竟放哪里?)
测试程序代码:
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<html>
<body>
<%Class.forName("org.gjt.mm.mysql.Driver").newInstance();
String url ="jdbc:mysql://localhost/softforum?user=soft&password=soft1234&useUnicode=true&characterEncoding=8859_1"
//first为你的数据库名
Connection conn= DriverManager.getConnection(url);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="select * from first";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()) {%>
您的第一个字段内容为:<%=rs.getString(1)%>
您的第二个字段内容为:<%=rs.getString(2)%>
<%}%>
<%out.print("数据库操作成功,恭喜你");%>
<%rs.close();
stmt.close();
conn.close();
%>
</body>
</html>
报错:
第一种错误:An error occurred at line: 13 in the jsp file: /first.jsp
rs cannot be resolve;(google了好久,都没弄明白)
第二种错误:An error occurred at line: 93 in the generated java file
Syntax error on token "catch", Identifier expected(代码只有不到50行,哪里来的line93)?
还有如何改这个?
更重要的是,我如何确定我能连接上mysql数据库啊?有咩有更好更简单的办法呢?
谢谢。。。
这是一条镜像帖。来源:北邮人论坛 / www-technology / #18376同步于 2012/12/11
该镜像源已超过 30 天没有更新,可能在源站已被删除。
WWWTechnology机器人发帖
[求助]windows tomcat配完以后,测试老出错,不知咋修改。谢谢
W1039766642
2012/12/11镜像同步1 回复
订阅后,新回复会通过你的通知中心匿名送达。
1 条回复