最近连接数据库的时候时不时会出错,特别当多刷新两次的时候更容易出,我想应该是连接池的参数的问题,希望得到这些参数的详细解释,以做相应修改
<Resource name="Test" 
        type="javax.sql.DataSource" 
        driverClassName="com.mysql.jdbc.Driver" 
        password="****" 
        maxIdle="2" 
        maxWait="5000" 
        username="root" 
        url="jdbc:mysql://localhost:3306/haxinbbs" 
        maxActive="4"/>我想知道三个参数maxIdle  maxWait  maxActive
越详细点越好
还有一般情况下设置为多少?

解决方案 »

  1.   

    <!-- maxActive: Maximum number of dB connections in pool. Make sure you
             configure your mysqld max_connections large enough to handle
             all of your db connections. Set to 0 for no limit.
             -->    <!-- maxIdle: Maximum number of idle dB connections to retain in pool.
             Set to -1 for no limit.  See also the DBCP documentation on this
             and the minEvictableIdleTimeMillis configuration parameter.
             -->    <!-- maxWait: Maximum time to wait for a dB connection to become available
             in ms, in this example 10 seconds. An Exception is thrown if
             this timeout is exceeded.  Set to -1 to wait indefinitely.
             -->
    这是官方的解释