File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Connection object in context listenter

 
A Kumar
Ranch Hand
Posts: 980
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a doubt....
Suppose,
you write code to create connection in the context listener...for a
database that resides at a remote location..

in due course of time..if there is a problem in network where in you are not able to access the database... and sometime later..the network problem is restored...

then what happens to the connection ??

Regards
 
Eddy Lee Sin Ti
Ranch Hand
Posts: 135
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The cached connection will become stale and throw exception when you try to do some database operations. You should explicitly open and close the connection whenever it is possible. By using some connection pooling data source, open connection means obtaining an opened connection from the pool and close is to return the connection back to the pool. The pool can be configured to invalidate the stale connection and recreate them.
 
A Kumar
Ranch Hand
Posts: 980
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eddy,

I posted the doubt with reference to the below post...

Database Connection

Regards
 
Joel Hutters
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use autoReconnect=true on your connection url.
 
A Kumar
Ranch Hand
Posts: 980
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Joel!!! I would check with that...
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic