Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Q on cached datasource

 
Neel Krish
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Philip Shanks
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you test it by dropping your app server's network interface to simulate the database crash?
 
Neel Krish
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic