Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 734037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:19:33+00:00 2026-05-14T07:19:33+00:00

I have to check connection leak in my application i.e. open connections which have

  • 0

I have to check connection leak in my application i.e. open connections which have not been closed.

After searching, after I found out that a thousands times connections have been opened but I can’t manually go to each and every code fragment and check for connection close thing.

I think, it could be possible using a regular expression but the fact is, I am not that well versed with regex that I could write one.

Please suggest a regular expression for checking in a no of java files that a opened connection has been closed or not.

My code pattern is something like this.

    try {
        /*
         Some code goes here
         */ 

     con = EJBUtil.getConnection(JNDI_NAME);

        /*
         Some code goes here
         */ 
         } 
    finally 
       {
            /*
              Some code goes here
           */ 
            DBUtil.close(con);
     or
         closeConnection.close(con);
           /*
            Some code goes here
           */ 
      } 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T07:19:34+00:00Added an answer on May 14, 2026 at 7:19 am

    As a first cut, run FindBugs or PMD over your code. Both of the have rules for detecting source code in which database resources are not or may not be properly closed. And they will probably highlight lots of other issues that are worth fixing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a connection leak in some older Java web applications which do not
I have PhoneGap-Android application and I want to check network connection type (No connection,
In my application, I have a Service which is responsible for looking after a
I would like to have a thread running in background which will check connection
I have to check whether the connection between Excel and DB2 has been established
I have created an tableview that shows RSSS. I check for internet connection then
In a table column I have check boxes which gives me indicator whether i
I have to check memory performance of my application, I have solved Leaks now
Hi i have something like this JOptionPane.showMessageDialog(null, Config.CHECK_INTERNET_CONNECTION); System.out.println(go); // HERE I CHECK MY
I have stackedwidget with multiple pages, at page one, I check the connection, page

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.