File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Oracle/OAS and the fly likes ojdbc14.jar connection pool cache issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "ojdbc14.jar connection pool cache issue" Watch "ojdbc14.jar connection pool cache issue" New topic
Author

ojdbc14.jar connection pool cache issue

ken zhu
Greenhorn

Joined: Apr 09, 2009
Posts: 20
/**
* java file1 named ServerInformationInit, initinal connection pool cache. Any update need?
*
*/
public static OracleDataSource ods = new OracleDataSource(); // is a statci variable will be used in other java file
prop.setProperty("MinLimit", "5");// set cache properties
prop.setProperty("MaxLimit", "20");
prop.setProperty("InitialLimit", "5");
prop.setProperty("ConnectionWaitTimeout","3");
prop.setProperty("InactivityTimeout", "3");
ods.setConnectionCachingEnabled(true); // be sure set to true
ods.setConnectionCacheProperties(prop);
ods.setConnectionCacheName("eform_db_cache"); // this cache's name
url = "jdbcracle:thin:@" + EformAplProperty.getDbHostName() + ":" +
EformAplProperty.getDbPort() + ":" + EformAplProperty.getDbSid();
ods.setURL(url);
ods.setUser(EformAplProperty.getDbUserName());
ods.setPassword(EformAplProperty.getDbPassword());


/**
* java file 2 named DefnSqlManager is all DAO file's parent
*/
connection = ServerInformationInit.ods.getConnection();
...............
OracleConnectionCacheManager occm =
OracleConnectionCacheManager.getConnectionCacheManagerInstance();
System.out.println
(occm.getNumberOfAvailableConnections("eform_db_cache")
+ " connections are available in cache " + "eform_db_cache");
System.out.println
(occm.getNumberOfActiveConnections("eform_db_cache")
+ " connections are active");

/**
* java file 3 named QaCmptCaseSqlManager extend DefnSqlManager, which retrieve data from database
*/
sqlMgr = new QaCmptCaseSqlManager();
cmptEntity = sqlMgr.genCmptCaseDoc(docId)
finally {
sqlMgr.closeDbConn();
}

below message is printed in console:
4 connections are available in cache eform_db_cache
14 connections are active
3 connections are available in cache eform_db_cache
15 connections are active
4 connections are available in cache eform_db_cache
14 connections are active
3 connections are available in cache eform_db_cache
15 connections are active
2 connections are available in cache eform_db_cache
2 connections are available in cache eform_db_cache
16 connections are active
16 connections are active

As you see, the connections are available in cache is less and most of connections are in active.
The result is system will create more and more connection for application, i don't what wrong about it ?



[Thumbnail for toad_sessiones.JPG]

 
Don't get me started about those stupid light bulbs.
 
subject: ojdbc14.jar connection pool cache issue
 
Similar Threads
Does JDBC Use Certs or CA's ?
Does ojdbc14.jar compatible with oracle9i
Refresh() method of oracleConnectionCacheManager!
Query regarditng Connection Pooling
please answer this 128 questions for WLS. Urgently!