java.sql.sqlexception no suitable driver fo_出现java.sql.SQLException: No suitable driver的几种解决办法...

今天在用C3p0连接MySql数据库 这个时候出现了上面的错误,

一般来说这种错误有3个方向解决 一般都是db的配置的问题 ,一定要小心DB 的配置

八月 19, 2017 8:30:46 下午 com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask run

警告: com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@2b8dab95 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:

java.sql.SQLException: No suitable driver

at java.sql.DriverManager.getDriver(Unknown Source)

at com.mchange.v2.c3p0.DriverManagerDataSource.driver(DriverManagerDataSource.java:223)

at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134)

at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)

at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)

at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)

at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)

at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)

at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)

at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)

1.:(1)很有可能c3p0-config.xml中的配置文件出现问题

这些配置一定要配置正确,像  第一个图片就忘记了一个“冒号“

java.sql.sqlexception no suitable driver fo_出现java.sql.SQLException: No suitable driver的几种解决办法..._第1张图片

java.sql.sqlexception no suitable driver fo_出现java.sql.SQLException: No suitable driver的几种解决办法..._第2张图片

2) 将Jar包放入Java lib目录

在JAVA_HOME目录下的jre\lib\ext文件下(如E:\jdk8\jre\lib\ext)放置一个连接MySQL数据库的jar包mysql- connector-java-****-bin.jar

3)Jar 包没有加入到Buildpath

看jar包是否在Referenced Libraries 里

java.sql.sqlexception no suitable driver fo_出现java.sql.SQLException: No suitable driver的几种解决办法..._第3张图片

你可能感兴趣的:(no,suitable,driver,fo)