• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java code

 
prabhu kandanur
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
i wanted to list out list of java classes, where the connection/preparedstatement open. Is there any readymade java code/tool available to check in the DAO package.

Thanks inadvance
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

i wanted to list out list of java classes, where the connection/preparedstatement open

classes? Do you mean instances, or are you only looking for a way to parse classes and find out where a JDBC connection may be opened?

(Please, UseAMeaningfulSubjectLine in future. Thanks )
 
prabhu kandanur
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry for that,
i wanted to list all java classes in a package, where connection is opened but not closed. i wanted to get those java classes list.
thanks
 
Paul Clapham
Sheriff
Posts: 21583
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could perhaps use javap to disassemble the classes. This might enable you to find classes where the Connection.close method was not called. But just because a class contains a call to Connection.close, that doesn't mean the call is actually executed reliably and correctly at run time. There isn't any automated way to determine that.

So you might be better off just doing a source-code search to identify the classes where connections are created, then have a person look at each of those classes.
 
Vinod K Singh
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Opening and closing connection in each class is a bad idea as it will lead to degraded performance.

To find the connection not closed do text search on your code.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic