急!jsp连接sqlsever时的问题
在不连接数据库时,jsp能运行,但连接数据库时会出现如下的问题:
HTTP Status 500 -
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: /test.jsp
Syntax error on tokens, delete these tokens
2: <%@ page import= "java.sql.* "%>
3: <html> <head> </head>
4: <body>
5: <%Class.forName( "com.microsoft.jdbc.sqlserver.SQLServerDriver ").newInstance();
6: String url= "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=test ";
7: String user= "sa ";
8: String password= "1233651406wh ";
An error occurred at line: 5 in the jsp file: /test.jsp
Syntax error, insert "; " to complete Statement
2: <%@ page import= "java.sql.* "%>
3: <html> <head> </head>
4: <body>
5: <%Class.forName( "com.microsoft.jdbc.sqlserver.SQLServerDriver ").newInstance();
6: String url= "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=test ";
7: String user= "sa ";
8: String password= "1233651406wh ";
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:435)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:299)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.23 logs.
请问这是怎么回事,我的测试程序如下
<%@ page contentType= "text/html;charset=gb2312 "%>
<%@ page import= "java.sql.* "%>
<html> <head> </head>
<body>
<%Class.forName( "com.microsoft.jdbc.sqlserver.SQLServerDriver ").newInstance();
String url= "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=test ";
String user= "sa ";