JSP连接SQLServer2000出错,请求帮助
我的JSP代码如下:
<%@ page language= "java " contentType= "text/html; charset=GB18030 "
pageEncoding= "GB18030 "%>
<%@ page import= "java.sql.* "%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN " "http://www.w3.org/TR/html4/loose.dtd ">
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=GB18030 ">
<title> 学生成绩管理系统 </title>
</head>
<body bgcolor= "blue ">
<h3> 学生成绩管理系统 </h3>
<%
Class.forName( "com.microsoft.jdbc.sqlserver.SQLServerDriver ").newInstance();
String url= "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=sgs ";
String username= "sa ";
String password= "123456 ";
Connection con=DriverManager.getConnection(url,username,password);
if(con==null)
{
%>
对不起数据库连接出错!
<%
}
Statement stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
%>
<table border=1 align=center>
<tr>
<td> 学生学号 </td> <td> 学生姓名 <td/> <td> 班级 <td/> <td> 专业 <td/>
</tr>
<%
String sql= "select * from student ";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()){
%>
<tr>
<td> <%=rs.getString( "学号 ") %> </td>
<td> <%=rs.getString( "姓名 ") %> </td>
<td> <%=rs.getString( "班级 ") %> </td>
<td> <%=rs.getString( "专业 ") %> </td>
</tr>
<%
}
rs.close();
stmt.close();
con.close();
//dbconn.releaseConnection(con);
%>
</table>
</body>
</html>
运行后的出错报告如下:
exception
org.apache.jasper.JasperException: Exception in JSP: /index.jsp:18
15: String url= "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=sgs ";
16: String username= "sa ";
17: String password= "101210 ";
18: Connection con=DriverM