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

The Archive Base Latest Questions

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

If I use $ sqlite3 fileName sqlite> .s sqlite>_ and there is no file

  • 0

If I use

$ sqlite3 fileName
sqlite> .s
sqlite>_

and there is no file named fileName, sqlite3 creates a new empty database. Is there a way to avoid this? Ideally, I would like it to retry a couple of times if the file is not found, then fail with an error message. Something like this:

$ sqlite3 --failIfNoSuchFile --retry 3 fileName
sqlite> No such file, retrying ...
sqlite> No such file, retrying ...
sqlite> No such file, retrying ...
sqlite> Aborting...
Error: No file named fileName
$_

Is something like this possible?

The reason I ask is because an existing database we had was crushed and replaced by this new blank database just because a networking problem prevented sqlite3 from finding the file in the first place but did not prevent it from creating the new empty one (and crushing the old one)! At least, that’s the most probable theory we’ve come up with to explain the sudden emptiness of the database (even the structure was gone, .s returned nothing and the file size was 0)

Any ideas?

btw, in the actual context, a tcl script connects to the database and inserts data. The problem appeared as a “table not found” error and we found out the database file was empty..

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

    I’m not aware of a flag to have sqlite3 do this. Could you just have you tcl script check for the file before calling sqlite3?

    Would something like this work:

    if {[file exists $dbName] == 1} {
        # call sqlite3 in here
        return 0
    } else {
        error "database file not found: $dbName"
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to use sqlite3 with CI? I've previously used the sqlite3
I have a file name database.sqlite which contains data that I have to use.
My application makes use of a SQLite database to store the user's inputs. The
I use Netbeans IDE (6.5) and I have a SQLite 2.x database. I installed
I use connect() and cursor() for using SQLite self.connector = sqlite3.connect(self.dbFile) self.cursor = self.connector.cursor()
I use the code below to insert data into my sqlite-database but for some
I am completely new to SQLite and I intend to use it in a
I'm developing an application in android. I use an sqlite3 database. But I need
So, I'm planning to use sqlite3 to update skype's main.db file. I use sqlite3_open
in my app i use Using an existing sqlite database and i need to

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.