Setting up a property pool on oracle.jdbc.pool.OracleDataSource

I am using oracle.jdbc.pool.OracleDataSource to pool pools. I would like the pool to check if the connection was closed properly and to catch up with it. I tried the following:

ods = new OracleDataSource();

ods.setConnectionCachingEnabled(true);
ods.setConnectionCacheName(CACHE_NAME);

Properties cacheProps = new Properties();
cacheProps.setProperty("MinLimit", Integer.toString(1));
cacheProps.setProperty("MaxLimit", Integer.toString(6));
cacheProps.setProperty("InitialLimit", "1");
cacheProps.setProperty("AbandonedConnectionTimeout", "2");

ods.setConnectionCacheProperties(cacheProps);

I connect active connections as follows:

occm = OracleConnectionCacheManager.getConnectionCacheManagerInstance();
occm.getNumberOfActiveConnections(CACHE_NAME);

If I do not close the connection in the application, the pool just fills to 6, so

cacheProps.setProperty("AbandonedConnectionTimeout", "2");

does not work. Why?

Any hint would be appreciated

+3
source share
2 answers

According to the Oracle tutorial, there is another property.

, : PropertyCheckInterval, AbandonedConnectionTimeout LowerThresholdLimit. PropertyCheckInterval , .

 cacheProps.setProperty("PropertyCheckInterval", "1");

- 15 ...

, , , , , , . , .

+5

:

cacheProps.setProperty("InactivityTimeout", "2")

cacheProps.setProperty("AbandonedConnectionTimeout", "2")

cacheProps.setProperty("PropertyCheckInterval", "1")
0

Source: https://habr.com/ru/post/1769506/


All Articles