连接池配置信息看看啊。<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="" />
<property name="jdbcUrl" value="" />
<property name="user" value="" />
<property name="password" value="" />
<property name="minPoolSize" value="" />
<property name="maxPoolSize" value="" />
<property name="maxStatements" value="" />
<property name="maxIdleTime" value="}" />
</bean>一般都是这样配置的。

解决方案 »

  1.   


    在这里。<?xml version="1.0" encoding="UTF-8"?>
    <c3p0-config>
    <default-config>
    <property name="driverClass">com.mysql.jdbc.Driver</property>
    <property name="jdbcUrl">jdbc:mysql://localhost:3306/hou?autoReconnect=true&amp;useUnicode=true&amp;createDatabaseIfNotExist=true&amp;characterEncoding=utf-8</property>
    <property name="user">root</property>
    <property name="password">hou</property>
    <!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 -->
    <property name="acquireIncrement">20</property>
    <property name="minPoolSize">10</property>
    <!--初始化时获取三个连接,取值应在minPoolSize与maxPoolSize之间。Default: 3 -->
    <property name="initialPoolSize">20</property> <!--最大空闲时间,60秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 -->
    <property name="maxIdleTime">60</property> <!--连接池中保留的最大连接数。Default: 15 -->
    <property name="maxPoolSize">80</property>
    <!--定义在从数据库获取新连接失败后重复尝试的次数。Default: 30 -->
    <property name="acquireRetryAttempts">30</property>

    <!--两次连接中间隔时间,单位毫秒。Default: 1000 -->
    <property name="acquireRetryDelay">100</property>

    <!--获取连接失败将会引起所有等待连接池来获取连接的线程抛出异常。但是数据源仍有效
    保留,并在下次调用getConnection()的时候继续尝试获取连接。如果设为true,那么在尝试
    获取连接失败后该数据源将申明已断开并永久关闭。Default: false-->
    <property name="breakAfterAcquireFailure">true</property>


    <!--每60秒检查所有连接池中的空闲连接。Default: 0 -->
    <property name="idleConnectionTestPeriod">20</property>
    <!--JDBC的标准参数,用以控制数据源内加载的PreparedStatements数量。但由于预缓存的statements
    属于单个connection而不是整个连接池。所以设置这个参数需要考虑到多方面的因素。
    如果maxStatements与maxStatementsPerConnection均为0,则缓存被关闭。Default: 0-->
    <property name="maxStatements">100</property>

    <!--maxStatementsPerConnection定义了连接池内单个连接所拥有的最大缓存statements数。Default: 0 -->
    <property name="maxStatementsPerConnection">50</property>
    <!-- sssstest
    <property name="testConnectionOnCheckin">true</property>
    <property name="testConnectionOnCheckout">true</property> --> </default-config>
    </c3p0-config>