Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Utility to check open DB connection ?

 
Karn Kumar
Ranch Hand
Posts: 153
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All ,


In the project say somewhere connection is not closed .

So is there is anything(any utility , api or something) in Java to check the Java Class where we have open DB connection ?


Thanks in advance ..


- Chetan

 
T Mishra
Ranch Hand
Posts: 108
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you deploy your application on JBoss and you've missed to close connection during a unit of work that involves transaction, then JBoss sends a warning message to close the connection.

Otherwise, you can check it using Connection.isClosed()
 
Karn Kumar
Ranch Hand
Posts: 153
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tushar , for your reply..

Yeah i can use isClosed() method to check if connection is closed or not , but i want some functionality or some tool which will tell me exact class where i missed closing connection in live application.

 
T Mishra
Ranch Hand
Posts: 108
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not aware of / used such tools. Perhaps an expert advice is needed here. What I think of is to write a method in the transaction layer as a checkpoint.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic