• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

java code

 
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
 
Bartender
Posts: 10336
Hibernate Eclipse IDE 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
 
Sheriff
Posts: 24594
55
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.
 
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.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!