Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / May 2006

Tip: Looking for answers? Try searching our database.

Commons DBCP/Tomcat/Oracle RAC Questions

Thread view: 
jimc - 16 May 2006 14:46 GMT
Does anybody know if the commons db pooling will work out of the box
with Oracle RAC?

It seems that the connection string will be different; however, some
Oracle documentation says that for Fast Connection Failover to work the
implicit connection cache must be enabled.

That seems to indicate that some Oracle specific coding may need to
occur to derive all the benefits of RAC.
kuassi.mensah@gmail.com - 17 May 2006 18:08 GMT
Fast Connection Fail-over (FCF) is an extension of the Oracle JDBC
Implicit Connection Cache, to RAC. It work in conjunction with RAC
events and Oracle's Notification System (ONS).
In order for Commons db pooling to support RAC similar to FCF, it must
subscribe to RAC events notification and process the events in
questions.

If the Oracle documentation is not enough, you can find more details
(including code fragment) in my book
http://www.amazon.com/gp/product/1555583296/
Kuassi, http://db360.blogspot.com/
jimc - 18 May 2006 13:23 GMT
That's pretty much what I thought too.

So the real question is whether the commons pooling does this. Does
anybody know the answer to that?
kuassi.mensah@gmail.com - 18 May 2006 17:24 GMT
Hi,

Being product manager for the Oracle JDBC (among other
responsibilities), i cannot speak for Apache Commons dbcp but i am
certain than no other driver and connection pool than Oracle does this,
currently.
Juha Laiho - 18 May 2006 19:42 GMT
"jimc" <jimcross@jimcross.com> said:
>Does anybody know if the commons db pooling will work out of the box
>with Oracle RAC?
>
>It seems that the connection string will be different; however, some
>Oracle documentation says that for Fast Connection Failover to work the
>implicit connection cache must be enabled.

After reading through the other responses so far, I guess that the needed
support is not in the commons db pooling.

I've written (but unfortunately cannot share) a piece of code that
enables direct use of Oracle JDBC in Tomcat, including parametrization
for implicit connection cache. Actually it wasn't too hard to get the
two ends to meet.
Signature

Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
        PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)

kuassi.mensah@gmail.com - 19 May 2006 21:32 GMT
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=por
tal+%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/
Juha Laiho - 20 May 2006 09:51 GMT
"kuassi.mensah@gmail.com" <kuassi.mensah@gmail.com> said:
>Using Oracle JDBC connection caching with Tomcat should not be
>different than using it with a stand-alone Java/JDBC code.

Ah, yes; I didn't write clearly enough.

The target was to keep the actual application code db-agnostic,
and write a JNDI provider for Tomcat so that application uses
the regular J2EE mechanisms for getting connections, and Tomcat
handles pooling etc independently of the application.
Signature

Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
        PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.