各位高手:
我在连接数据库是的代码是: <%@ page contentType= "text/html; charset=gb2312 " language= "java " import= "java.sql.* " errorPage= " " %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN " "http://www.w3.org/TR/html4/loose.dtd ">
<%@ page contentType= "text/html;charset=gb2312 "%>
<%@ page import= "java.sql.* "%>
<html>
<body>
<%Class.forName( "net.sourceforge.jtds.jdbc.Driver ").newInstance();
String url= "jdbc:jtds:sqlserver://135.0.0.2:1433/Northwind;USER=sa;PASSWORD=webserver ";
Connection conn= DriverManager.getConnection(url);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql= "select * from Orders ";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()) {%>
您的第一个字段内容为: <%=rs.getString(1)%>
您的第二个字段内容为: <%=rs.getString(2)%>
<%}%>
<%out.print( "数据库操作成功,恭喜你 ");%>
<%rs.close();
stmt.close();
conn.close();
%>
</body>
</html>
然后报错是:
--------------------------------------------
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 5 in the jsp file: /1.jsp
Generated servlet error:
[javac] Compiling 1 source file
D:\Tomcat\work\Catalina\localhost\_\org\apache\jsp\_1_jsp.java:43: illegal character: \12288
An error occurred at line: 5 in the jsp file: /1.jsp
Generated servlet error:
????String url= "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=bysj ";
^
An error occurred at line: 5 in the jsp file: /1.jsp
Generated servlet error:
D:\Tomcat\work\Catalina\localhost\_\org\apache\jsp\_1_jsp.java:43: illegal character: \12288
An error occurred at line: 5 in the jsp file: /1.jsp
Generated servlet error:
????String url= "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=bysj ";
^
An error occurred at line: 5 in the jsp file: /1.jsp
Generated servlet error:
D:\Tomcat\work\Catalina\localhost\_\org\apache\jsp\_1_jsp.java:44: illegal character: \12288
????//pubs涓轰?????????
^
An error occurred at line: 5 in the jsp file: /1.jsp