• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Dangling connection of tomcat with postgresql database

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


When i am doing in windows when i stop the tomcat, application will release the hold on database, since application will stop with tomcat..But in ubuntu even if i stop the tomcat application is not releasing the access to database

i tried with sudo /etc/init.d/tomcat6 stop
sudo service tomcat6 stop

i can't use pkill since if i kill the process, even connection to database server got released..i needed to start it manually..i only want to release access to database from application..How can i do it?

Any where tomcat is holding the application? or any other process there which is on hold?

Please show me a solution, what makes difference in windows and ubuntu?

Thanks in Advance,
varghese
 
Saloon Keeper
Posts: 25477
180
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Varghese Renny wrote:0 down vote favorite




A webapp written according to accepted standards obtains database connections from a connection pool that is constructed, owned, and maintained by the server. This pool can actually be defined at a level that allows sharing it between multiple webapps, depending on how the server.xml file was configured.

Regardless, since the whole point of having a pool is that the pool holds open database connections so that the system will be spared the overhead of repeatedly creating and destroying them, there's not a whole lot of support for physically closing connections - the pool connections are fa├žades for actual Connection objects, where the pool connection's close() method simply returns the underlying open Connection back to the pool.

If you undeploy a webapp, that should cause the pool to be eligible for garbage collection, which should in turn make the Connection objects collectible, which will eventually shut down the Connection. Without checking the Tomcat source, however, I don't know if there's an explict "terminate pool" API method that Tomcat can use to forcibly cause the pool to clean up on command rather than whenever the garbage collector gets around to it.

All in all, the simplest and most reliable way to release all those connections would be to terminate Tomcat itself. For most uses, that's sufficient.
 
Sheriff
Posts: 22649
126
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:

Varghese Renny wrote:0 down vote favorite



This post was apparently a nearly exact copy-paste from StackOverflow: http://stackoverflow.com/questions/11735864/how-to-release-access-to-application-from-tomcat-on-ubuntu-12-04.

Varghese, please BeForthrightWhenCrossPostingToOtherSites.
 
Always look on the bright side of life. At least this ad is really tiny:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic