jsp连接sqlserver数据库的问题
jsp文件如下:
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<html>
<body>
<%Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=test";
//pubs为你的数据库的
String user="sa";
String password="111";
Connection conn= DriverManager.getConnection(url,user,password);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="select * from ddd";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()) {%>
您的第一个字段内容为:<%=rs.getString(1)%>
您的第二个字段内容为:<%=rs.getString(2)%>
<%}%>
<%out.print("数据库操作成功,恭喜你");%>
<%rs.close();
stmt.close();
conn.close();
%>
</body>
</html>
运行报错:
Generated servlet error:
[javac] Since fork is true, ignoring compiler setting.
[javac] Compiling 1 source file
[javac] Since fork is true, ignoring compiler setting.
[javac] D:\Tomcat 4.1\work\Standalone\localhost\examples\test_jsp.java:47: illegal character: \12288
[javac] ????String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=test";
[javac] ^
[javac] D:\Tomcat 4.1\work\Standalone\localhost\examples\test_jsp.java:47: illegal character: \12288
[javac] ????String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=test";
[javac] ^
[javac] D:\Tomcat 4.1\work\Standalone\localhost\examples\test_jsp.java:48: illegal character: \12288
[javac] ????//pubs涓轰?????????
[javac] ^
[javac] D:\Tomcat 4.1\work\Standalone\localhost\examples\test_jsp.java:48: illegal character: \12288
[javac] ????//pubs涓轰?????????
[javac] ^
[javac] D:\Tomcat 4.1\work\Standalone\localhost\examples\test_jsp.java:49: illegal character: \12288
[javac] ????String user="sa";
[javac] ^
[javac] D:\Tomcat 4.1\work\Standalone\localhost\examples\test_jsp.java:49: illegal character: \12288
[javac] ????String user="sa";
[javac] ^
[javac] D:\Tomcat 4.1\work\Standalone\localhost\examples\test_jsp.java:50: illegal character: \12288
[javac] ????String password="111";
[javac] ^
[javac] D:\Tomcat 4.1\work\Standalone\localhost\examples\test_jsp.java:50: illegal character: \12288
[javac] ????String password="111";
[javac] ^
[javac] D:\Tomcat 4.1\work\Standalone\localhost\examples\test_jsp.java:51: illegal character: \12288
[javac] ????
[javac] ^
[javac] D:\Tomcat 4.1\work\Standalone\localhost\examples\test_jsp.java:51: illegal character: \12288
[javac] ????
[javac] ^
[javac] D:\Tomcat 4.1\work\Standalone\localhost\examples\test_jsp.java:52: illegal character: \12288
[javac] ????Connection conn= DriverManager.getConnection(url,user,password);
[javac] ^
[javac] D:\Tomcat 4.1\work\Standalone\localhost\examples\test_jsp.java:52: illegal character: \12288
[javac] ????Connection conn= DriverManager.getConnection(url,user,password);
[javac] ^
[javac] D:\Tomcat 4.1\work\Standalone\localhost\examples\test_jsp.java:53: illegal character: \12288
[javac] ????Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
[javac] ^
[javac] D:\Tomcat 4.1\work\Standalone\localhost\examples\test_jsp.java:53: illegal character: \12288
[javac] ????Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
[javac] ^
[javac] D:\Tomcat 4.1\work\Standalone\localhost\examples\test_jsp.java:54: illegal character: \12288
[javac] ????String sql="select * from ddd";
[javac] ^
[javac] D:\Tomcat 4.1\work\Standalone\localhost\examples\test_jsp.java:54: illegal character: \12288
[javac] ????String sql="select * from ddd";
[javac] ^
[javac] D:\Tomcat 4.1\work\Standalone\localhost\examples\test_jsp.java:55: illegal character: \12288
[javac] ????ResultSet rs=stmt.executeQuery(sql);
[javac] ^
[javac] D:\Tomcat 4.1\work\Standalone\localhost\examples\test_jsp.java:55: illegal character: \12288
[javac] ????ResultSet rs=stmt.executeQuery(sql);
[javac] ^
[javac] D:\Tomcat 4.1\work\Standalone\localhost\examples\test_jsp.java:56: illegal character: \12288
[javac] ????while(rs.next()) {
[javac] ^
[javac] D:\Tomcat 4.1\work\Standalone\localhost\examples\test_jsp.java:56: illegal character: \12288
[javac] ????while(rs.next()) {
[javac] ^
[javac] D:\Tomcat 4.1\work\Standalone\localhost\examples\test_jsp.java:67: illegal character: \12288
[javac] ????stmt.close();
[javac] ^
[javac] D:\Tomcat 4.1\work\Standalone\localhost\examples\test_jsp.java:67: illegal character: \12288
[javac] ????stmt.close();
[javac] ^
[javac] D:\Tomcat 4.1\work\Standalone\localhost\examples\test_jsp.java:68: illegal character: \12288
[javac] ????conn.close();
[javac] ^
[javac] D:\Tomcat 4.1\work\Standalone\localhost\examples\test_jsp.java:68: illegal character: \12288
[javac] ????conn.close();
[javac] ^
[javac] D:\Tomcat 4.1\work\Standalone\localhost\examples\test_jsp.java:69: illegal character: \12288
[javac] ????
[javac] ^
[javac] D:\Tomcat 4.1\work\Standalone\localhost\examples\test_jsp.java:69: illegal character: \12288
[javac] ????
[javac] ^
[javac] D:\Tomcat 4.1\work\Standalone\localhost\examples\test_jsp.java:70: illegal character: \12288
[javac] ????
[javac] ^
[javac] D:\Tomcat 4.1\work\Standalone\localhost\examples\test_jsp.java:70: illegal character: \12288
[javac] ????
[javac] ^
[javac] 28 errors
望解决