为什么我写的总是连接出错,tomcat 5.0,提示http500错误,数据库是mysql,我都是照书写的啊?代码如下,十分谢谢!!!
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test Connect to MySQL</title>
</head>
<body>
sdkjfsladjflkasjfl;kajs
<% String Drv="org.git.mm.mysql.Driver";
String Jdbc="jdbc:mysql://localhost:3306";
String admin="root";
String pwd="fssy_118";
String sql="select * from user_info";
try{
Class.forName(Drv).newInstance();
Connection conn=DriverManager.getConnection(Jdbc);
Statement stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery(sql);
if(rs.next()){
out.println("11111111111111111");
}else{
out.println("2222222222222222");
}
}catch(SQLException e){
e.getSQLState();
}
%>
</body>
</html>
连接部分有错吗?谢谢了,十分感谢!!