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 6101439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:30:00+00:00 2026-05-23T13:30:00+00:00

Is it efficient method to open database connection for every database operation and accordingly

  • 0

Is it efficient method to open database connection for every database operation and accordingly close
or open the connection at the starting and keep calling the same opened connection for multiple operation and close it when all the activities is done. ?

I am creating a Java Swing application where i have a main frame and using the card layout i am selecting different panel and each of this panel have different database operation to perform. Presently i am having individual connection opened for each panel , so when i open my main application multiple connection gets opened and closed.

As i want to be sure that i am doing the right thing and avoid any bad practice and bottleneck in performance so i am asking this question to Java Experts.

Please suggest .Thanks for all your help .

  • 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-23T13:30:00+00:00Added an answer on May 23, 2026 at 1:30 pm

    No, it isn’t recommended to “create” a new connection for each database transaction. Creating connections is typically expensive. Try using a connection pool which abstracts the connection open and close semantics. That way, your application can call Connection#close etc. and behind the scenes the pool will grab and return connections to the connection poll accordingly. There are many solutions out there; DBCP, C3P0 or BoneCP.

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

Sidebar

Related Questions

Is there an efficient method of converting an integer into the written numbers, for
What would be the most efficient method of reading a text file into a
Given an arbitrary string, what is an efficient method of finding duplicate phrases? We
Efficient way to handle COM related errors in C++ . For instance: switch (HRESULT_CODE(hresult))
What's the most efficient algorithm to find the rectangle with the largest area which
What's the most efficient way to concatenate strings?
What's the most efficient way to resize large images in PHP? I'm currently using
What is the most efficient way to determine how many comments a particular blog
Which is more efficient for the compiler and the best practice for checking whether
What's the most efficient way to convert the output of this function from a

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.