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

  • Home
  • SEARCH
  • 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 6042099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:45:10+00:00 2026-05-23T06:45:10+00:00

I am creating an app that uses an SQL database for storing data. The

  • 0

I am creating an app that uses an SQL database for storing data. The way the app is designed it will be updated every 3 minutes or so with new data depending on user actions while the app is running.

In the tutorials I have seen, they recommend that you close the database after changing it (it is an “expensive” in terms of resources).

Is it better to leave it open for the duration of my App since it is being updated on a fairly frequent basis or should I run the close() method immediately after every change?

I guess my worry is that opening it and closing it constantly will draw more resources than it would to leave it open the entire time.

  • 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-23T06:45:10+00:00Added an answer on May 23, 2026 at 6:45 am

    I tried to leave a connection open once — I used it to stuff a repeater or something — can’t remember now.

    Later in the program, I had another need to use the connection — I think I had it so that when a user clicked a parent item in the repeater, a detail div would pop-up with more information for that item. This generated an error — something to the effect of ‘cannot open() on an open connection’.

    I think the error might have been avoidable another way (like checking to see if the connection I was trying to open was already open), but as I thought about it, I realized I’d have to make that a standard practice throughout my app, and that seemed like too much work, so I just made it a standard practice to always close my connections after each use.

    Connections stay in a connection pool — I’m no whiz on that — but if was curious about performance, I guess I’d keep that in mind, in terms of what it costs to open a connection multiple times — whatever your situation is requiring anyway.

    Another thought is that your DB admin may be able to force-close all open connections, or the db may close for some other reason. If you’re not the dba, you might give a thought to risk/benefit of depending on something that you don’t have long-term control over like keeping the connection open.

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

Sidebar

Related Questions

I am creating an app that that uses a tabbed view. I pull data
I am fairly new to android and I am creating an app that uses
I'm creating an app that uses a disk to browse files and such, like
I am creating an app that uses tabs. I want to be able to
I'm creating an app that needs to be accessed by both a web front
I am creating a small console app that needs a progress bar. Something like...
I'm creating a small app in ASP.NET MVC that generates ics (iCal) files based
I'm creating an asp.net app with just some lite data access from xml files.
My record sheet app has a menu option for creating a new, blank record
I'm trying to create some Functional tests for a Django app that uses South

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.