java+tomcat连接数据库问题
我用java+tomcat连接数据库,在运行程序时报错,提示不能装载jdbc驱动.可我已经把jdbc驱动部署到了tomcatlib中怎么还出现这个错误?我的jdbc驱动是...
我用java+tomcat连接数据库,在运行程序时报错,提示不能装载jdbc驱动.可我
已经把jdbc驱动部署到了tomcat lib中怎么还出现这个错误?我的jdbc驱动是mysql-connector-java-5.1.7-bin,tomcat版本是apache-tomcat-6.0.24.请帮忙解答:
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.MySQL.jdbc.Driver'
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1136)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
at jead.chap4.WebDBUtility.getConnection(WebDBUtility.java:16)
at jead.chap4.TestDB.getUserList(TestDB.java:14)
at org.apache.jsp.queryuser_jsp._jspService(queryuser_jsp.java:67)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.ClassNotFoundException: com.MySQL.jdbc.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1130)
... 22 more 展开
已经把jdbc驱动部署到了tomcat lib中怎么还出现这个错误?我的jdbc驱动是mysql-connector-java-5.1.7-bin,tomcat版本是apache-tomcat-6.0.24.请帮忙解答:
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.MySQL.jdbc.Driver'
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1136)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
at jead.chap4.WebDBUtility.getConnection(WebDBUtility.java:16)
at jead.chap4.TestDB.getUserList(TestDB.java:14)
at org.apache.jsp.queryuser_jsp._jspService(queryuser_jsp.java:67)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.ClassNotFoundException: com.MySQL.jdbc.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1130)
... 22 more 展开
9个回答
展开全部
你数据库驱动版本是5你MY SQL版本也必须是5版本的
还有一个是你仔细查看一下你JDBC连接数据库驱动名是不是完全正确,区分大小写的,如果大写的小写,小写的大写也是连不上的。看你的错误应该是驱动名错误。你仔细找找。
还有一个是你仔细查看一下你JDBC连接数据库驱动名是不是完全正确,区分大小写的,如果大写的小写,小写的大写也是连不上的。看你的错误应该是驱动名错误。你仔细找找。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
部署的不对 要不然不会出现 Cannot load JDBC driver class 'com.MySQL.jdbc.Driver'这个错误的,或者把tomcat重启下看看
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
建议LZ这样尝试:
1. 看看是否有相关数据库的驱动包
2. 看看是否连接数据库的语句是否有细节上的错误。
1. 看看是否有相关数据库的驱动包
2. 看看是否连接数据库的语句是否有细节上的错误。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
这位朋友,我用过oracle数据库,不过我知道,那玩意在和前端连接的时候。要配置网络部分,不知道你会配置吗?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
把JDBC的jar包放到tomcat的lib里就可以了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询