OracleConnectionCacheManager - Event Listener

Posted on 2005-05-14
Last Modified: 2007-12-19

I have an Oracle 10g database and we are developping a 3-tier application. I am currently working on the database connection management (Connection Pooling) and would like to notify client applications when there is a problem with connecting to the database and then notify when connection is available again later.

At first, I used OracleDataSource and OraclePooledConnection, but now it seems that OracleConnectionCacheManager is much more useful and "powerful". Now that this is implemented, how can I add an event listener to the caching object so that when physical connection to DB goes down, my app could send a notification?

Question by:whiteeagl

    Author Comment

    Is there any good/better way to check if the connection still is working?

    Author Comment

    I'm still looking for a good solution concerning this connection validation problem.

    Is there somthing like validationQuery for OracleDataSource or ConnectionCacheManager ?

    I know that I could simply query the DB every time the users need a connection, but I guess it is just a workaround...

    Accepted Solution

    try with the ValidateConnection property on the Connection Cache:

    OracleDataSource ods = new OracleDataSource();
    //Enable caching
    //Set the cache name
    PropertsProperties = new java.util.Properties();
    sProperties.setProperty("MinLimit", "1");
    sProperties.setProperty("MaxLimit", "20");
    sProperties.setProperty("ValidateConnection", "true"); // Validates connection before sending to client
    OracleConnectionCacheManager sConnectionCacheMananger = OracleConnectionCacheManager.getConnectionCacheManagerInstance();
    sConnectionCacheMananger.createCache(CACHE_NAME, ods, sProperties);

    Author Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    Title # Comments Views Activity
    commonTwo  challenge 63 69
    powerN  challenge 3 35
    pairs challenge 5 29
    java  and programming certification ? 4 28
    Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
    Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
    Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
    This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now