请问一下数据库连接的问题。。
请问一下数据库连接的问题,,
我总把连接数据库的代码统一的放在一个文件里,,比如说叫connectdb.jsp
可是总是出现错误。。。应该怎么去改,,,错误信息如下:
[求助]jsp+msSql连接错误
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: 2 in the jsp file: /incoming/connectdb.jsp Generated servlet error: D:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\news\org\apache\jsp\incoming\connectdb_jsp.java:48: cannot resolve symbol symbol : class Connection location: class org.apache.jsp.incoming.connectdb_jsp Connection con=DriverManager.getConnection(url,"sa","123"); ^ An error occurred at line: 2 in the jsp file: /incoming/connectdb.jsp Generated servlet error: D:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\news\org\apache\jsp\incoming\connectdb_jsp.java:48: cannot resolve symbol symbol : variable DriverManager location: class org.apache.jsp.incoming.connectdb_jsp Connection con=DriverManager.getConnection(url,"sa","123"); ^ An error occurred at line: 2 in the jsp file: /incoming/connectdb.jsp Generated servlet error: D:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\news\org\apache\jsp\incoming\connectdb_jsp.java:49: cannot resolve symbol symbol : class Statement location: class org.apache.jsp.incoming.connectdb_jsp Statement ^ An error occurred at line: 2 in the jsp file: /incoming/connectdb.jsp Generated servlet error: D:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\news\org\apache\jsp\incoming\connectdb_jsp.java:50: cannot resolve symbol symbol : variable ResultSet location: class org.apache.jsp.incoming.connectdb_jsp smt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); ^ An error occurred at line: 2 in the jsp file: /incoming/connectdb.jsp Generated servlet error: D:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\news\org\apache\jsp\incoming\connectdb_jsp.java:50: cannot resolve symbol symbol : variable ResultSet location: class org.apache.jsp.incoming.connectdb_jsp smt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); ^ An error occurred at line: 2 in the jsp file: /incoming/connectdb.jsp Generated servlet error: D:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\news\org\apache\jsp\incoming\connectdb_jsp.java:51: cannot resolve symbol symbol : class ResultSet location: class org.apache.jsp.incoming.connectdb_jsp ResultSet rs; ^ 6 errors org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84) org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332) org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412) org.apache.jasper.compiler.Compiler.compile(Compiler.java:472) org.apache.jasper.compiler.Compiler.compile(Compiler.java:451) org.apache.jasper.compiler.Compiler.compile(Compiler.java:439) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
搜索更多相关主题的帖子:
数据库
----------------解决方案--------------------------------------------------------
能把程序发一下么。。
----------------解决方案--------------------------------------------------------
应该是你的很多类都没有import进来哈
才会出现什么目标不能确定拉等问题
----------------解决方案--------------------------------------------------------