Running sqlite3 will open up an in-memory database to start with.
".open test" will either open the file "test" if it exists, or create the file 
if it doesn't. You will then be working on that file called "test" which is 
your database.

The help line for .save is:
.save FILE               Write in-memory database into FILE

".save test" tries to save the current database to the file "test". Since you 
already have the file "test" open in the CLI tool, when it tries to open it a 
second time to run the .save command it's getting the "database is locked" 
error. In fact it seems weird it lets you try at all since at that point you 
don't have an in-memory database open, but have an actual file open.

Once you do the ".open test" anything you do is done on the "test" 
file/database. There is no need to save it with .save. "saving" is all through 
normal database transactions at that point.


-----Original Message-----
From: sqlite-users <sqlite-users-boun...@mailinglists.sqlite.org> On Behalf Of 
Alexander Gabriel
Sent: Friday, August 30, 2019 12:11 PM
To: sqlite-users@mailinglists.sqlite.org
Subject: [sqlite] .save always errors: database is locked

Hi

I do this:

   - restart windows10 or macOS and log in (to guarantee no other process
   is using sqlite3)
   - cd to the folder where sqlite3 v3.29.0 is contained
   - type `sqlite3` (windows 10) or `./sqlite3` (macOS) to start sqlite3
   - type `.open test`, followed by `.save test`

Result: `Error: database is locked`

What am I doing wrong?
How can I change configuration if I can never save changes?

The only time I can save without an error is when I `.save test2` without
having opened it before.

Alex
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to