File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Monitoring  JDBC connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Monitoring  JDBC connection" Watch "Monitoring  JDBC connection" New topic

Monitoring JDBC connection

Sri Anand
Ranch Hand

Joined: Mar 06, 2005
Posts: 392
I have connection leak problem in my application , i see that number of connections creep up as days pass by finally they are all consumed, we ar using oracle toplink, and orien server are there any tools available that would help me figure out the connection leaks , i did some research and found tools like JDBMonitor , but i wasnt sure if they can help me figure out connection leaks or just SQL performance monitoring
Ryan Muster

Joined: Nov 11, 2007
Posts: 18
I would go ask this in the TopLink forum. I dont think watching dB connection would help, it has to be tied to the software, and I'm thinking something like this is probably possible to see with the right log level.
Ken Krebs
Ranch Hand

Joined: Nov 27, 2002
Posts: 451
I haven't worked with TopLink but it seems to me that monitoring the DB connections won't help you find where the TopLink Session is not being properly closed which presumably is responsible for closeing the connection.

This is a common problem not only with TopLink, but also with Hibernate, JPA, and straight JDBC. One thing you can use to help avoid this type of problem is Spring. Spring has a variety of classes that implement the Template pattern. These Template classes, i.e. JdbcTemplate/JpaTemplate/ToplinkTemplate/HibernateTemplate relieve your code from having to deal with managing these resources.

When your code calls on ToplinkTemplate to perform an operation, it will make 1 or more callbacks into your code with a Session that it creates using a TopLink SessionFactory. You can then perform whatever Session operations are needed. After your code returns, Spring will make sure the Session and any other resources are cleaned up. This allows your code to focus on delivering business functionality and not resource management.

Say goodbye to cut-and-paste boilerplate resource management code that is so easy to screw up.

[ November 15, 2007: Message edited by: Ken Krebs ]

kktec<br />SCJP, SCWCD, SCJD<br />"What we observe is not nature itself, but nature exposed to our method of questioning." - Werner Heisenberg
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33098

While we don't have a TopLink forum, I think this fits better in JDBC as it has to do with connection monitoring.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
steve souza
Ranch Hand

Joined: Jun 26, 2002
Posts: 862
The jamon jdbc driver is proxy that can use any underlying jdbc driver including oracles. With it you can track many things about jdbc and sql including: jdbc method calls (such as close) on Connection/Statement/ResultSet, sql performance stats for each sql command, SQL exceptions. The jamon jdbc driver requires no code changes just change your connection url and driver class.

jamon also allows you to monitor web pages, log4j method calls, and ejb3 invocations all without changing any code (via a jboss/tomcat valve, log4j appender, ejb3 inerceptor). If you use spring there is also a jamon interceptor that comes as part of Spring.

JAMon is open source and available at my links below. You can also view a live demo in the links below. - a fast, free open source performance tuning api.
JavaRanch Performance FAQ
I agree. Here's the link:
subject: Monitoring JDBC connection
It's not a secret anymore!