c3p0 配置连接MySQL异常: java.sql.SQLException: Connections could not be acquired from the underlying datab

c3p0 配置连接MySQL异常:

java.sql.SQLException: Connections could not be acquired from the underlying database!
##
遇到这个问题,可能有2个原因(解决方案):
1.就是jar引入不对,版本可能不对,最主要可能缺少包,以下2个jar包一定要加入;

(1)c3p0-0.9.5.2.jar
(2)mchange-commons-java-0.2.3.4.jar

2.配置文件配置得不对,要注意,name属性的值第一个字母一定要小写,不然真的出不来

<c3p0-config>
  
  <named-config name="mvcapp">
  <property name="user">rootproperty>
  <property name="password">123456property>
  <property name="driverClass">com.mysql.jdbc.Driverproperty>
  <property name="jdbcUrl">jdbc:mysql://localhost:3306/db_studentinfoproperty>


    <property name="acquireIncrement">5property>
    <property name="initialPoolSize">10property>
    <property name="minPoolSize">10property>
    <property name="maxPoolSize">50property>

    
    <property name="maxStatements">20property> 
    <property name="maxStatementsPerConnection">5property>
  named-config>
c3p0-config>

你可能感兴趣的:(java)