PoolDataSource pds = PoolDataSourceFactory.getPoolDataSource();
try {
LOGGER.info("testing Pool creation ::::" );
LOGGER.info("testing Pool creation :::: in test" );
if (StringUtils.isEmpty(poolname)) {
throw new UCPConnectionException("Pool name derived from Sys-config was not valid...");
}
if (StringUtils.isEmpty(url)|| StringUtils.isEmpty(user) || StringUtils.isEmpty(pswd)) {
throw new UCPConnectionException(
"Invalid Connection Parameters.Terminating the creation of Pool DataSource");
}
//String ONS_CONFIG = "nodes=hract21:6200,hract22:6200,hract23:6200";
//pds.setONSConfiguration ( ONS_CONFIG);
//pds.setFastConnectionFailoverEnabled( true);
pds.setConnectionFactoryClassName(factoryName);
pds.setURL(url);
pds.setUser(user);
pds.setPassword(DatabaseConnectionHelper.decryptPassword(pswd));
pds.setConnectionPoolName(poolname);
pds.setInitialPoolSize(50);
// Default is 0. Set the minimum number of connections
// that is maintained by UCP at runtime.
pds.setMinPoolSize(50);
// Default is Integer.MAX_VALUE (2147483647). Set the maximum number of
// connections allowed on the connection pool.
pds.setMaxPoolSize(200);
// Default is 30secs. Set the frequency in seconds to enforce the timeout
// properties. Applies to inactiveConnectionTimeout(int secs),
// AbandonedConnectionTimeout(secs)& TimeToLiveConnectionTimeout(int secs).
// Range of valid values is 0 to Integer.MAX_VALUE. .
pds.setTimeoutCheckInterval(25);
// Default is 0. Set the maximum time, in seconds, that a
// connection remains available in the connection pool.
pds.setInactiveConnectionTimeout(50);
// Set the JDBC connection properties after pool has been created
Properties connProps = new Properties();
connProps.setProperty("fixedString", "false");
connProps.setProperty("remarksReporting", "false");
connProps.setProperty("restrictGetTables", "false");
connProps.setProperty("includeSynonyms", "false");
connProps.setProperty("defaultNChar", "false");
connProps.setProperty("AccumulateBatchResult", "false");
// JDBC connection properties will be set on the provided
// connection factory.
pds.setConnectionProperties(connProps);
// hardcoded values end
pds.setValidateConnectionOnBorrow(true);
// pds.setConnectionProperties(connProps);
LOGGER.info("Establishing Pool creation ::::::::::::::::::::::::::::::::::::: ::::" + poolname);
UniversalConnectionPoolManagerImpl.getUniversalConnectionPoolManager()
.createConnectionPool((UniversalConnectionPoolAdapter) pds);
LOGGER.info("Starting Pool creation ::::" + poolname);
UniversalConnectionPoolManagerImpl.getUniversalConnectionPoolManager().startConnectionPool(poolname);
} catch (Exception ue) {
ue.printStackTrace();
LOGGER.error("Unable to create/Start the UCP connection pool due to " + ue.getMessage());
throw new UniversalConnectionPoolException("Exception occured when trying to create the pool ");
}
return pds;
============================================
ERROR | Nov 24, 11:00:31] com.oracle.cegbu.microservice.sync.service.db.connection.ManageDBConnectionPool:121 - Unable to create/Start the UCP connection pool due to oracle.ucp.UniversalConnectionPoolException: Failed to create initialPoolSize connections while starting a pool: java.lang.NullPointerException at oracle.ucp.util.UCPErrorHandler.newUniversalConnectionPoolException(UCPErrorHandler.java:336) ~[oracle.ucp.jar:19.3.0.0.0] at oracle.ucp.util.UCPErrorHandler.throwUniversalConnectionPoolException(UCPErrorHandler.java:59) ~[oracle.ucp.jar:19.3.0.0.0] at oracle.ucp.common.Core.initialize(Core.java:1783) ~[oracle.ucp.jar:19.3.0.0.0] at oracle.ucp.common.UniversalConnectionPoolBase.start(UniversalConnectionPoolBase.java:705) ~[oracle.ucp.jar:19.3.0.0.0] at oracle.ucp.jdbc.oracle.OracleJDBCConnectionPool.start(OracleJDBCConnectionPool.java:129) ~[oracle.ucp.jar:19.3.0.0.0] at oracle.ucp.admin.UniversalConnectionPoolManagerBase.startConnectionPool(UniversalConnectionPoolManagerBase.java:363) ~[oracle.ucp.jar:19.3.0.0.0] at com.oracle.cegbu.microservice.sync.service.db.connection.ManageDBConnectionPool.createConnectionPool(ManageDBConnectionPool.java:118) [sync-client-service.jar:20.12.0.0] at com.oracle.cegbu.microservice.sync.service.akka.process.SyncProcessSingleton.createPools(SyncProcessSingleton.java:99) [sync-client-service.jar:20.12.0.0] at com.oracle.cegbu.microservice.sync.service.akka.process.SyncProcessSingleton.poolInitlize(SyncProcessSingleton.java:77) [sync-client-service.jar:20.12.0.0]