This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hello, We are on WAS3.5. We are caching the datasource at a particular initialization point and from there on this same datasource is being used for all further database connections. Lets assume that at some point in time, the database goes down. Obviosuly the datasource will not be able to get any connections and will keep throwing SQLExceptions. Now when the database is re-started, what will happen to the cachedDatasource.getConnection()? Will this continue to fail? Or will it start getting connections? I thought it would continue to fail unless this cached datasource is "refreshed" . Help me understand. Thanks, Neel
Can you test it by dropping your app server's network interface to simulate the database crash?
Philip Shanks, SCJP - Castro Valley, CA
My boss never outsources or has lay-offs, and He's always hiring. I work for Jesus! Prepare your resume!
Joined: Mar 26, 2001
well i won't be able to do that since we share our server with quite a few applications. but as my luck would have it, couple of days back the database crashed. the first getConnection() call failed with a SQLException of a "communication protocol error". and it never recovered. the database was down for about 15 mnts. we recycled our app instance and everything started working fine. one observation - i have a single standalone page which basically is like monitor. it checks whether all the components/interfaces/connections are working fine. it is a single stop for us to determine what is failing. interstingly, i loaded this page when the database was down and as expected i got the connection exception. but on a refresh after a few minutes, it was able to establish a connection successfully. the only difference between this and the application code is, i do not use the cached datasource. datasource is obtained through a jndi lookup everytime this page is loaded. this makes me wonder whether i should nullify the cached datasource and re-lookup whenever a db crash related connexion failure occurs. thanks, neel