• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

stale connection exception

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

we were using stale connection exception in our application and our server was websphere.

now we have to migrate 2 tomcat..and stale connection exception is not supported here..pls suggest me in replacement of this an equivalent exception.in tomcat 5X server..

thanks,
kuldeep
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you explain what exactly that stale connection exception of Websphere is, and how and for what purposes you use it in your application? For which kind of connections do you use it?
 
kuldeep oli
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jesper Young:
Can you explain what exactly that stale connection exception of Websphere is, and how and for what purposes you use it in your application? For which kind of connections do you use it?

 
kuldeep oli
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jesper Young:
Can you explain what exactly that stale connection exception of Websphere is, and how and for what purposes you use it in your application? For which kind of connections do you use it?




staleconnection exception is subclass of sqlexception used to print proper messages,reasons... when connection goes down
we are using it to catch sqlexceptions.
 
Jesper de Jong
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which kind of connections? I guess database connections, if it's a subclass of SQLException? Are you using this to see if your application lost the connection to the database?

Are you using a connection pool? Web applications should always let the application server manage database connections in a connection pool. Your app should not be holding on to a database longer than necessary. If you let the application server manage database connections, then you don't need to add this kind of logic in your application.
 
kuldeep oli
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
catch(com.ibm.websphere.ce.cm.StaleConnectionException sce)
{
//logger.debug("***** Stale Connection failure :"+sce.getMessage () );
if (numOfRetries < 5)
{
retry = true;///it tries to re_establish connection whenever down,stale,�.
numOfRetries++;
//logger.debug("***** Retry # "+numOfRetries );
}
else
{
retry = false;
//logger.debug("***** Failed after "+numOfRetries+" retries, throwing exception");
throw sce;// throws exception with proper reason ,sql state ,vendor code.[extendds sql exception]
}
/////////////************/////////

the code looks like above.. and we cant remove this code and create any new custom class as we are not allowed .

we are using connection pooling...
 
Jesper de Jong
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by kuldeep oli:
the code looks like above.. and we cant remove this code and create any new custom class as we are not allowed .

we are using connection pooling...


Well, if you're not allowed to change any of this code, then you're not going to get it working on Tomcat, because the code is using an IBM Websphere-specific class that doesn't exist in Tomcat...
 
kuldeep oli
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But can we implement the same as websphere people have done..?

Will you be able to help me regarding this..
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic