当前位置:   article > 正文

java.sql.SQLException: No suitable driver 的详细解决办法_java.sql.sqlexception: no suitable driver at java.

java.sql.sqlexception: no suitable driver at java.sql.drivermanager.getdriv

java.sql.SQLException: No suitable driver 的详细解决办法


  1. com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask run
  2. 警告: com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@3627613e -- 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:
  3. java.sql.SQLException: No suitable driver
  4. at java.sql.DriverManager.getDriver(DriverManager.java:315)
  5. at com.mchange.v2.c3p0.DriverManagerDataSource.driver(DriverManagerDataSource.java:223)
  6. at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134)
  7. at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
  8. at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
  9. at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
  10. at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
  11. at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
  12. at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
  13. at com.mchange.v2.async.ThreadPerTaskAsynchronousRunner$TaskThread.run(ThreadPerTaskAsynchronousRunner.java:255)

遇到这个问题,解决办法:
  1.看是否导入了JDBC的驱动程序,如下面的mysql的JDBC的驱动程序

                                                   


2.看驱动程序是否添加到BuildPath中,右击驱动程序,选择BuildPath,点击Add BuildPath选择项,如果没有那个选择项,就说明已经添加BuildPath


3.看是否是c3p0-config.xml配置出错,要小心不要写错,比如下面的红色的可能出错,不能够写成“driver”或者是“driverclass”,这样就应该不会有问题了


  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <c3p0-config>
  3. <default-config>
  4. <property name="driverClass">com.mysql.jdbc.Driver</property>
  5. <property name="jdbcUrl">jdbc:mysql://localhost:3306/company</property>
  6. <property name="user">root</property>
  7. <property name="password">123456</property>
  8. <property name="initialPoolSize">10</property>
  9. <property name="maxIdleTime">30</property>
  10. <property name="maxPoolSize">100</property>
  11. <property name="minPoolSize">10</property>
  12. </default-config>
  13. </c3p0-config>





声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/593481
推荐阅读
相关标签
  

闽ICP备14008679号