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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:43:39+00:00 2026-06-17T11:43:39+00:00

I have been under the understanding that database connections are best used and closed.

  • 0

I have been under the understanding that database connections are best used and closed. However with SQLite Im not sure that this applies. I do all the queries with a Using Connection statment. So it is my understanding that I open a connection and then close it doing this. When it comes to SQLite and optimal usage, is it better to open one permament connection for the duration of the program being in use or do I continue to use the method that I currently use.

I am using the database for a VB.net windows program with a fairly large DB of about 2gig.

My current method of connection example

  Using oMainQueryR As New SQLite.SQLiteCommand
            oMainQueryR.CommandText = ("SELECT * FROM CRD")
            Using connection As New SQLite.SQLiteConnection(conectionString)
                Using oDataSQL As New SQLite.SQLiteDataAdapter
                    oMainQueryR.Connection = connection
                    oDataSQL.SelectCommand = oMainQueryR
                    connection.Open()
                    oDataSQL.FillSchema(crd, SchemaType.Source)
                    oDataSQL.Fill(crd)
                    connection.Close()
                End Using
            End Using
    End Using
  • 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-06-17T11:43:40+00:00Added an answer on June 17, 2026 at 11:43 am

    As with all things database, it depends. In this specific case of sqlite, there are two “depends” you need to look at:

    1. Are you the only user of the database?
    2. When are implicit transactions committed?

    For the first item, you probably want to open/close different connections frequently if there are other users of the database or if it’s all possible that more than process will be hitting your sqlite database file at the same time.

    For the second item, I’m not sure how sqlite specifically behaves. Some database engines don’t commit implicit transactions until the connection is closed. If this is the case for sqlite, you probably want to be closing your connection a little more often.

    The idea that connections should be short-lived in .Net applies mainly to Microsoft Sql Server, because the .Net provider for Sql Server is also able to take advantage of a feature known as connection pooling. Outside of Sql Server this advice is not entirely without merit, but it’s not as much of a given.

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

Sidebar

Related Questions

I know that this question has been approached under different ways, but I have
I have been under the impression for that JavaScript was always asynchronous. However, I
I have a problem that I am not sure of the best way to
I have been under the assumption for a while that viewDidUnload is always called
I'm developing an indie video game, and have been operating under the assumption that
I have been using a TSQL trigger under the assumption that the inserted table
I have a little app that has been under development for some time. My
I have been under the impression that processes on the operating system have three
I have a very large program which I have been compiling under visual studio
I have been researching how to get Cygwin to work under emacs . I

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.