web开发中JDBC 驱动连接失败问题

用测试类本地的 test.java对数据库进行操作是没问题的. 然后换用jsp就出错了. 以下是错误信息

java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/myBlog at java.sql.DriverManager.getConnectionDriverManager.java:689 at java.sql.DriverManager.getConnectionDriverManager.java:247 at util.JDBCUtil.getConnectionJDBCUtil.java:12 at dao.ArticleDao.getArticleArticleDao.java:114 at org.apache.jsp.test_jsp._jspServicetest_jsp.java:125 at org.apache.jasper.runtime.HttpJspBase.serviceHttpJspBase.java:70 at javax.servlet.http.HttpServlet.serviceHttpServlet.java:729 at org.apache.jasper.servlet.JspServletWrapper.serviceJspServletWrapper.java:443 at org.apache.jasper.servlet.JspServlet.serviceJspFileJspServlet.java:385 at org.apache.jasper.servlet.JspServlet.serviceJspServlet.java:329 at javax.servlet.http.HttpServlet.serviceHttpServlet.java:729 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilterApplicationFilterChain.java:232 at org.apache.catalina.core.ApplicationFilterChain.doFilterApplicationFilterChain.java:165 at org.apache.tomcat.websocket.server.WsFilter.doFilterWsFilter.java:53 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilterApplicationFilterChain.java:193 at org.apache.catalina.core.ApplicationFilterChain.doFilterApplicationFilterChain.java:165 at filter.SystemContextFilter.doFilterSystemContextFilter.java:36 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilterApplicationFilterChain.java:193 at org.apache.catalina.core.ApplicationFilterChain.doFilterApplicationFilterChain.java:165 at filter.CharFilter.doFilterCharFilter.java:21 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilterApplicationFilterChain.java:193 at org.apache.catalina.core.ApplicationFilterChain.doFilterApplicationFilterChain.java:165 at org.apache.catalina.core.StandardWrapperValve.invokeStandardWrapperValve.java:199 at org.apache.catalina.core.StandardContextValve.invokeStandardContextValve.java:105 at org.apache.catalina.authenticator.AuthenticatorBase.invokeAuthenticatorBase.java:506 at org.apache.catalina.core.StandardHostValve.invokeStandardHostValve.java:140 at org.apache.catalina.valves.ErrorReportValve.invokeErrorReportValve.java:79 at org.apache.catalina.core.StandardEngineValve.invokeStandardEngineValve.java:87 at org.apache.catalina.connector.CoyoteAdapter.serviceCoyoteAdapter.java:343 at org.apache.coyote.http11.Http11Processor.serviceHttp11Processor.java:1078 at org.apache.coyote.AbstractProcessorLight.processAbstractProcessorLight.java:66 at org.apache.coyote.AbstractProtocol$ConnectionHandler.processAbstractProtocol.java:760 at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.runNioEndpoint.java:1524 at java.util.concurrent.ThreadPoolExecutor.runWorkerThreadPoolExecutor.java:1142 at java.util.concurrent.ThreadPoolExecutor$Worker.runThreadPoolExecutor.java:617 at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.runTaskThread.java:61 at java.lang.Thread.runThread.java:745

1.驱动jar包放的位置不对
2.Classpath中没有加入合适的mysql_jdbc驱动
3.驱动字符串出错com.mysql.jdbc.Driver
4.连接URL格式出现了问题Connection conn=DriverManager.getConnection”jdbc:mysql://localhost:3306/XX”,”root”,”XXXX” 

发表评论

电子邮件地址不会被公开。 必填项已用*标注