JDBC connection check

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chicago1985
    New Member
    • Oct 2007
    • 9

    #1

    JDBC connection check

    I am always checking if any of my JDBC has Database leaks with our Oracle 9i database.

    Here is what I use in SQL Plus:
    Code:
    select username, program from v$session where username = 'myUserSchemaName';
    If I dont close my connections the above query shows a program running called JDBC Thin Client. If I do alot of JDBC inserts and updates in my Web Application, the query will show many lines of JDBC Thin Client showing up.
    When I do close my connections correctly and do alot of inserts and updates in my Web Application, the above query doesnt show any programs running so I assume I dont have any database leaks?

    This is my way and would like to know how experienced Java developers check to make sure all their Database connections are closed?
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by chicago1985
    This is my way and would like to know how experienced Java developers check to make sure all their Database connections are closed?
    Use a connection pool and close the open connection in the pool at the end.
    The Apache commons project has a few nice connection pools implemented.

    kind regards,

    Jos

    Comment

    Working...