JSP环境配好了,为什么连接MSSQL时就会出错呢
我的环环境是windows2003+tomcat5.5+jdk1.5+MSSQL
我已按要求装好了以上软件,并且http://localhost:8080访问可以显示大花猫了,说明安装成功,可是我把我的程序考在root目录下,运行没有涉及到数据库的地方都会正确,但运行到有涉及连接数据库的地方就会出错,这是为什么呢?我是这样连库的:
public class DBConn {
String dbDriver = "com.microsoft.jdbc.sqlserver.SQLServerDriver ";
String strCon = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=UplifeOA ";
String user = "sa ";
String pass = "111 ";
Connection con = null;
ResultSet rs = null;
Statement stmt = null;
public DBConn() {
try
{
Class.forName(dbDriver);
}
catch (
java.lang.ClassNotFoundException e)
{
System.err.println( "数据库驱动程序加载失败,异常为: "+ e.getMessage());
}
finally
{
System.out.println( "驱动程序加载成功 ");
}
}
连接的帐号密码肯定不会错,我的JSP以前是有正常运行过的,只是重装过后,配置不起来了,我是把我以前所有那程序考到root目录下的,当运行到有涉及到连接数据库如登陆页面时就会报如下错误:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: /inc/pass.jsp(2,0) The value for the useBean class attribute uplife.tool.Tools is invalid.
org.apache.jasper.servlet.JspServletWrapper.handle
JspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
org.apache.jasper.
JasperException: /inc/pass.jsp(2,0) The value for the useBean class attribute uplife.tool.Tools is invalid.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:146)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1174)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Generator.generate(Generator.java:3305)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
org.apache.jasper.compiler.Compiler.compile(Compi