简体   繁体   中英

Exception while connecting to postgress DB in Windows Machine

Getting the below exception while connecting to postgress DB in Windows Machine. Could somebody please help on this

Using c3p0-0.9.5.2.jar

Exception :

2018-09-26 15:53:41,841 ERROR, com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run , A RESOURCE POOL IS PERMANENTLY BROKEN! [com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@87274ea] (because a series of 20 acquisition attempts failed.) 2018-09-26 15:53:41,841 ERROR, com.mchange.v2.resourcepool.BasicResourcePool.unexpectedBreak , com.mchange.v2.resourcepool.BasicResourcePool@735b478 -- Unexpectedly broken!!!

com.mchange.v2.resourcepool.ResourcePoolException: Unexpected Break Stack Trace! at com.mchange.v2.resourcepool.BasicResourcePool.unexpectedBreak(BasicResourcePool.java:974) at com.mchange.v2.resourcepool.BasicResourcePool.access$1000(BasicResourcePool.java:44) at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1927) at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696) java.sql.SQLException: An SQLException was provoked by the following failure: java.lang.InterruptedException at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:118) at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:77) at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:74) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:694) at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:146) Caused by: java.lang.InterruptedException at java.lang.Object.wait(Native Method) at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1465) at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:644) at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:554) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutAndMarkConnectionInUse(C3P0PooledConnectionPool.java:758) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:685) ... 6 more

private static ComboPooledDataSource cpds = new ComboPooledDataSource();
try {
cpds = new ComboPooledDataSource();
cpds.setDriverClass(BSMRCommonConstant.POSTGRES_DRIVER);
cpds.setAcquireIncrement(5);
cpds.setBreakAfterAcquireFailure(true);
cpds.setAcquireRetryAttempts(20);
cpds.setMaxPoolSize(20);
cpds.setMaxIdleTime(60 * 10);
cpds.setTestConnectionOnCheckout(true);
cpds.setAcquireRetryDelay(3000);            
cpds.setIdleConnectionTestPeriod(100);          
} catch (PropertyVetoException e) {
e.printStackTrace();
}
Connection con = null;
cpds.setJdbcUrl(url);
cpds.setPassword(password);
cpds.setUser(userName);
con = cpds.getConnection(userName, password); 

The c3po database connection pool cannot create a database connection within the configured timeout period.

This is most likely a configuration error. Have a hard look at the url you tell c3po to use.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM