Re: Commons DBCP/Tomcat/Oracle RAC Questions
- From: "kuassi.mensah@xxxxxxxxx" <kuassi.mensah@xxxxxxxxx>
- Date: 19 May 2006 13:32:22 -0700
Using Oracle JDBC connection caching with Tomcat should not be
different than using it with a stand-alone Java/JDBC code.
In summary:
a)create an Oracle data source
OracleDataSource ods = new OracleDataSource();
b) set the DataSource property ConnectionCachingEnabled to true
ods.setConnectionCachingEnabled(True);
c) optionally set more properties (see the Oracle JDBC doc for more
details @
http://www.oracle.com/pls/db102/to_pdf?pathname=java.102%2Fb14355.pdf&remark=portal+%28Application+development%29
)
ods.setConnectionCacheName("MyCache"); // optional
ods.setConnectionCacheProperties(cp); // optional
d) getConnection() will service connection requests from the cache (you
may pre-populate the cache with minimal number of connections,
otherwise the first connection requests will trigger connection
creation).
conn = ods.getConnection();
For Fast Connection Failover in RAC environments using 10g JDBC:
1) you need to configure ONS so that JDBC can subscribe to RAC events
and be notified upon node/instance/service failure or the addition of
new instance.
2) Then, enable FastConnectionFailover either programmatically
ods.setFastConnectionFailoverEnabled(true);
or using system property: java -D
oracle.jdbc.FastConnectionFailover=true
3) catch fatal SQLEXception (and retry if so). fata SQLException is a
list of SQL exceptions related to node/instance/service/network down
(user can programmatically add it's own exceptions)
See codes samples @
http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/files/oracle10g/index.html
See also complete step by step instructions in chapter 7 of my book @
http://www.amazon.com/gp/product/1555583296/
Kuassi, http://db360.blogspot.com/
.
- Follow-Ups:
- Re: Commons DBCP/Tomcat/Oracle RAC Questions
- From: Juha Laiho
- Re: Commons DBCP/Tomcat/Oracle RAC Questions
- References:
- Commons DBCP/Tomcat/Oracle RAC Questions
- From: jimc
- Re: Commons DBCP/Tomcat/Oracle RAC Questions
- From: Juha Laiho
- Commons DBCP/Tomcat/Oracle RAC Questions
- Prev by Date: JNDI JDBC ODBC & Win2003
- Next by Date: Re: Commons DBCP/Tomcat/Oracle RAC Questions
- Previous by thread: Re: Commons DBCP/Tomcat/Oracle RAC Questions
- Next by thread: Re: Commons DBCP/Tomcat/Oracle RAC Questions
- Index(es):