jsp连接SQL2000数据库出现的问题
各位高手:
我在连接数据库是的代码是: <%@ 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
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
Generated servlet error:
D:\Tomcat\work\Catalina\localhost\_\org\apache\jsp\_1_jsp.java:45: illegal character: \12288
????String user= "sa ";
^
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:45: illegal character: \12288
????String user= "sa ";
^
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:46: illegal character: \12288
????String password= "111111 ";
^
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:46: illegal character: \12288
????String password= "111111 ";
^
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:47: illegal character: \12288
????
^
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:47: illegal character: \12288
????
^
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:48: illegal character: \12288
????Connection conn= DriverManager.getConnection(url,user,password);
^
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:48: illegal character: \12288
????Connection conn= DriverManager.getConnection(url,user,password);
^
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:49: illegal character: \12288
????Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
^
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:49: illegal character: \12288
????Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
^
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:50: illegal character: \12288
????String sql= "select * from test ";
^
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:50: illegal character: \12288
????String sql= "select * from test ";
^
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:51: illegal character: \12288
????ResultSet rs=stmt.executeQuery(sql);
^
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:51: illegal character: \12288
????ResultSet rs=stmt.executeQuery(sql);
^
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:52: illegal character: \12288
????while(rs.next()) {
^
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:52: illegal character: \12288
????while(rs.next()) {
^
20 errors
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:127)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:351)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:415)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:458)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:552)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
note The full stack trace of the root cause is available in the Tomcat logs.
--------------------------------------------
Apache Tomcat/5.0.16
[解决办法]
出错的地方有其他的代码(虽然你看不见),把它削掉
[解决办法]
http://community.csdn.net/Expert/topic/5503/5503579.xml?temp=.9747126
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.myexception.cn/java-web/317.html
我的异常网推荐解决方案:org.apache.jasper.JasperException: Unable to compile class,http://www.myexception.cn/j2ee/2308.html