zoukankan      html  css  js  c++  java
  • 出现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中的配置文件出现问题

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

    2) 将Jar包放入Java lib目录

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

    3)Jar 包没有加入到Buildpath

    看jar包是否在Referenced Libraries 里

  • 相关阅读:
    bzoj4165 矩阵 堆维护多路归并
    bzoj2802 [Poi2012]Warehouse Store 贪心+堆
    bzoj1367 [Baltic2004]sequence 左偏树+贪心
    bzoj3011 [Usaco2012 Dec]Running Away From the Barn 左偏树
    uoj207 共价大爷游长沙 子树信息 LCT + 随机化 + 路径覆盖
    bzoj4764 弹飞大爷 LCT
    bzoj4817 & loj2001 [Sdoi2017]树点涂色 LCT + 线段树
    bzoj5020 & loj2289 [THUWC 2017]在美妙的数学王国中畅游 LCT + 泰勒展开
    bzoj4998 星球联盟 LCT + 并查集
    bzoj3091 城市旅行 LCT + 区间合并
  • 原文地址:https://www.cnblogs.com/mythdoraemon/p/7397839.html
Copyright © 2011-2022 走看看