File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Does ojdbc14.jar compatible with oracle9i Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Does ojdbc14.jar compatible with oracle9i " Watch "Does ojdbc14.jar compatible with oracle9i " New topic
Author

Does ojdbc14.jar compatible with oracle9i

ken zhu
Greenhorn

Joined: Apr 09, 2009
Posts: 20
Hi everybody,
I am new a comer from CHINA, please look after in future, i am thank you in advance.
I have a question want to ask you:
Does ojdbc14.jar compatible with oracle9i? I used the connection pool cache but found the connection don't back to pool when there have lots visiters, my program environment is jdk1.4 + oralce9i + ojdbc14.jar.
Anybody give me a hint or sample? thank you very much.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Yes it is.


the connection don't back to pool when there have lots visiters,

If the site is busy is the connection not just in use? What are you doing to release the connection?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
If you do not write JDBC code the proper way, i.e. using close() statements where required, then the connection will never be returned to the pool.

Write proper JDBC code, something like:

The same way of acquiring and closing applies to Statement, PreparedStatement and ResultSet as well.
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]

ken zhu
Greenhorn

Joined: Apr 09, 2009
Posts: 20
Paul Sturrock wrote:Yes it is.


the connection don't back to pool when there have lots visiters,

If the site is busy is the connection not just in use? What are you doing to release the connection?


Thanks your attention, i want system just create several connection in pool i.e.(5 connectiones) then every statement close/release connectio as soon as possible when finished. Because execute database is very fast we no need keep a connection so long time.
I don't know whether i describe clearly o
 
wood burning stoves
 
subject: Does ojdbc14.jar compatible with oracle9i