jsp连接sql server2000不了
我用的jdk1.5+tomcat5.5
jsp代码:
<%@ page contentType= "text/html;charset=GB2312 " %>
<%@ page import= "java.sql.* " %>
<html>
<body>
<% Connection con;
Statement sql;
ResultSet rs;
try{ Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver ");
}
catch(
ClassNotFoundException e){}
try{ con=DriverManager.getConnection( "jdbc:odbc:sun ", "sa ", " ");
sql=con.createStatement();
rs=sql.executeQuery( "SELECT * FROM students ");
out.print( " <Table Border> ");
out.print( " <TR> ");
out.print( " <TH width=100> "+“学号”);
out.print( " <TH width=100> "+“姓名”);
out.print( " <TH width=50> "+“数学成绩”);
out.print( " <TH width=50> "+“英语成绩”);
out.print( " <TH width=50> "+“物理成绩”);
out.print( " </TR> ");
while(rs.next())
{ out.print( " <TR> ");
out.print( " <TD> "+rs.getString(1)+ " </TD> ");
out.print( " <TD> "+rs.getString(2)+ " </TD> ");
out.print( " <TD> "+rs.getString(数学成绩)+ " </TD> ");
out.print( " <TD> "+rs.getString(英语成绩)+ " </TD> ");
out.print( " <TD> "+rs.getString(物理成绩)+ " </TD> ");
out.print( " </TR> ");
}
out.print( " </Table> ");
con.close();
}
catch(
SQLException e1){}
%>
</body>
</html>
错误提示是:
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 5 in the jsp file: /Example5_1.jsp
Syntax error on tokens, delete these tokens
2: <%@ page import= "java.sql.* " %>
3: <html>
4: <body>
5: <% Connection con;
6: Statement sql;
7: ResultSet rs;
8: try{