tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luciano Kiniti Issoe" <mia...@hotmail.com>
Subject Re: JDBC Connnection Pool for Oracle
Date Fri, 27 Sep 2002 19:06:28 GMT
 Zeechan, I use this in my code and it works fine doing both pooling and
connection cache. Read more about it at the Oracle docs.

import oracle.jdbc.pool.*;
           oracle.jdbc.pool.OracleConnectionPoolDataSource ocpds = new
OracleConnectionPoolDataSource();
            ocpds.setURL(hotstring); // jdbc:oracle:oci8:@<SID> or
jdbc:oracle:thin:@<HOST>:<SID>
            ocpds.setUser(user); //scott
            ocpds.setPassword(password); //tiger
            oracle.jdbc.pool.OracleConnectionCacheImpl occi = new
OracleConnectionCacheImpl(ocpds);
            //set the caching size from 3 to 10 growing in a DYNAMIC SCHEME
(create connections as needed and closes then as they become uneeded )
            occi.setMaxLimit(10);
            occi.setMinLimit(3);
            occi.setCacheScheme(OracleConnectionCacheImpl.DYNAMIC_SCHEME);

another option if you don't want to stick with Oracle your project's entire
life is using com.javaexchange.dbConnectionBroker.DbConnectionBroker,

you can find examples at http://www.javaexchange.com , but is simple as
follows:

        // The below statement sets up a Broker with a minimun pool size of
2 connections
        // and a maximum of 10.  The log file will be created in
        //  /tmp/DBConnectionBroker.log and the pool connections will be
        // restarted once a day.

        DBConnectionBroker broker = new DBConnectionBroker(dbDriver, dbURL,
userId, password,2,10, "//tmp//DBConnectionBroker.log",1.0);
        Connection conn = broker.getConnection();



hope it helps
Regards

miagi

--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message