日期:2014-05-18  浏览次数:20743 次

高手指点啊!!!我是这样用Jsp连接数据库的,为什么总是错啊???
<%
Class.forName("com.micrsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
String url="jdbc:microsoft:sqlserver://localhost:1433;databaseName=bookshop";
Connection con= DriverManager.getConnection(url,"sa","123");
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);  
ResultSet rs;
String sql;
String title="我要书网站管理系统";
%>


错误信息:
org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 4 in the jsp file: /common/connectdb.jsp
Connection cannot be resolved to a type
1: <%
2: Class.forName("com.micrsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
3: String url="jdbc:microsoft:sqlserver://localhost:1433;databaseName=bookshop";
4: Connection con= DriverManager.getConnection(url,"sa","123");
5: Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);  
6: ResultSet rs;
7: String sql;


An error occurred at line: 4 in the jsp file: /common/connectdb.jsp
DriverManager cannot be resolved
1: <%
2: Class.forName("com.micrsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
3: String url="jdbc:microsoft:sqlserver://localhost:1433;databaseName=bookshop";
4: Connection con= DriverManager.getConnection(url,"sa","123");
5: Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);  
6: ResultSet rs;
7: String sql;


An error occurred at line: 5 in the jsp file: /common/connectdb.jsp
Statement cannot be resolved to a type
2: Class.forName("com.micrsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
3: String url="jdbc:microsoft:sqlserver://localhost:1433;databaseName=bookshop";
4: Connection con= DriverManager.getConnection(url,"sa","123");
5: Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);  
6: ResultSet rs;
7: String sql;
8: String title="鎴戣涔︾綉绔欑鐞嗙郴缁?;


An error occurred at line: 5 in the jsp file: /common/connectdb.jsp
conn cannot be resolved
2: Class.forName("com.micrsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
3: String url="jdbc:microsoft:sqlserver://localhost:1433;databaseName=bookshop";
4: Connection con= DriverManager.getConnection(url,"sa","123");
5: Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);  
6: ResultSet rs;
7: String sql;
8: String title="鎴戣涔︾綉绔欑鐞嗙郴缁?;


An error occurred at line: 5 in the jsp file: /common/connectdb.jsp
ResultSet.TYPE_SCROLL_SENSITIVE cannot be resolved to a type
2: Class.forName("com.micrsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
3: String url="jdbc:microsoft:sqlserver://localhost:1433;databaseName=bookshop";
4: Connection con= DriverManager.getConnection(url,"sa","123");
5: Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);  
6: ResultSet rs;
7: String sql;
8: String title="鎴戣涔︾綉绔欑鐞嗙郴缁?;


An error occurred at line: 5 in the jsp file: /common/connectdb.jsp
ResultSet.CONCUR_UPDATABLE cannot be resolved to a type
2: Class.forName("com.micrsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
3: String url="jdb