[sqlite] Under what circumstances can a table be locked when the database is first opened?

2015-05-23 Thread da...@andl.org
Locking mode: Is this documented anywhere?

As I thought I said, it's a standalone program; run it to normal
termination; then run it again. Single connection, no flags enabled at open
(just the default).

Yes, I've been using Process Explorer for at least 10 years, since it was at
sysinternals. First place I looked and no, the database file is not locked.
If it was, I wouldn't have been able to delete it.

Regards
David M Bennett FACS

Andl - A New Data Language - andl.org
-Original Message-
From: sqlite-users-boun...@mailinglists.sqlite.org
[mailto:sqlite-users-bounces at mailinglists.sqlite.org] On Behalf Of Barry
Smith
Sent: Saturday, 23 May 2015 5:11 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Under what circumstances can a table be locked when
the database is first opened?

Hi,

Unless you are using shared cache, SQLite does not lock on a per table level
- only it locks the entire database.

Under what circumstances are you trying to access the database both times?
Are these multiple connections within the same process or are you shutting
down the process and then restarting? Do you have shared cached enabled?

Process Explorer is a windows tool that will tell you which process has open
handles on a particular file. I found it a right pita to use though.

Cheers,

Barry

> On 23 May 2015, at 1:42 pm, "Keith Medcalf"  wrote:
> 
> 
> 1)  Something else has the database open and locked.
> 2)  You are using Shared Cache
> 3)  Something forgot to finalize a select
> 4)  The database is stored on a non-locally-attached filesystem
> 5)  An issue in the version of SQLite you are using (and you did not 
> say which version you are using)
> 6)  A buggy filesystem driver (you did not say which one you are 
> using)
> 7)  Badly designed antivirus software
> 8)  Badly designed file syncronization software (for example, storing the
database in a directory that is being monitored and synced by badly designed
software (dropbox for example)).
> 
>> -Original Message-
>> From: sqlite-users-bounces at mailinglists.sqlite.org 
>> [mailto:sqlite-users- bounces at mailinglists.sqlite.org] On Behalf Of 
>> david at andl.org
>> Sent: Friday, 22 May, 2015 21:13
>> To: 'General Discussion of SQLite Database'
>> Subject: [sqlite] Under what circumstances can a table be locked when 
>> the database is first opened?
>> 
>> Question: Under what circumstances can a table be locked when the 
>> database is first opened?
>> 
>> My program does:
>> 
>> DROP TABLE IF EXISTS
>> CREATE TABLE
>> INSERT INTO (multiple times)
>> SELECT * (for each row)
>> 
>> Run it once and it works perfectly. Run it twice and the DROP TABLE 
>> triggers the error:
>> 
>> SQLITE_LOCKED, database table is locked
>> 
>> Delete the database and run it again and it works. Just once.
>> 
>> Nothing in the documentation tells me how a table can be locked when 
>> the database is first opened. I'm using the raw C interface on 
>> Windows, so what can I be doing wrong?
>> 
>> The code is actually written in C#, but uses Interop to call the C 
>> API directly. The database open code looks like this. No open flags are
used.
>> 
>> LastResult = (Result)sqlite3_open(path, out _dbhandle);
>> 
>> Regards
>> David M Bennett FACS
>> 
>> Andl - A New Data Language - andl.org
>> 
>> 
>> ___
>> sqlite-users mailing list
>> sqlite-users at mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> 
> 
> 
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users at mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



[sqlite] Under what circumstances can a table be locked when the database is first opened?

2015-05-23 Thread da...@andl.org
Thanks for the summary. Could be a useful addition to the docs.

1) single user.
2) I'm not 'using' anything. Just default open.
3) --> this could be it. How does this work exactly, and how do you avoid
it/correct it (after the event)?
4) N/A
5) Latest download.
6) Windows 8.1 NTFS.
7) None.
8) N/A.

Regards
David M Bennett FACS

Andl - A New Data Language - andl.org


-Original Message-
From: sqlite-users-boun...@mailinglists.sqlite.org
[mailto:sqlite-users-bounces at mailinglists.sqlite.org] On Behalf Of Keith
Medcalf
Sent: Saturday, 23 May 2015 1:42 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Under what circumstances can a table be locked when
the database is first opened?


1)  Something else has the database open and locked.
2)  You are using Shared Cache
3)  Something forgot to finalize a select
4)  The database is stored on a non-locally-attached filesystem
5)  An issue in the version of SQLite you are using (and you did not say
which version you are using)
6)  A buggy filesystem driver (you did not say which one you are using)
7)  Badly designed antivirus software
8)  Badly designed file syncronization software (for example, storing the
database in a directory that is being monitored and synced by badly designed
software (dropbox for example)).

> -Original Message-
> From: sqlite-users-bounces at mailinglists.sqlite.org 
> [mailto:sqlite-users- bounces at mailinglists.sqlite.org] On Behalf Of 
> david at andl.org
> Sent: Friday, 22 May, 2015 21:13
> To: 'General Discussion of SQLite Database'
> Subject: [sqlite] Under what circumstances can a table be locked when 
> the database is first opened?
> 
> Question: Under what circumstances can a table be locked when the 
> database is first opened?
> 
> My program does:
> 
> DROP TABLE IF EXISTS
> CREATE TABLE
> INSERT INTO (multiple times)
> SELECT * (for each row)
> 
> Run it once and it works perfectly. Run it twice and the DROP TABLE 
> triggers the error:
> 
> SQLITE_LOCKED, database table is locked
> 
> Delete the database and run it again and it works. Just once.
> 
> Nothing in the documentation tells me how a table can be locked when 
> the database is first opened. I'm using the raw C interface on 
> Windows, so what can I be doing wrong?
> 
> The code is actually written in C#, but uses Interop to call the C API 
> directly. The database open code looks like this. No open flags are used.
> 
> LastResult = (Result)sqlite3_open(path, out _dbhandle);
> 
> Regards
> David M Bennett FACS
> 
> Andl - A New Data Language - andl.org
> 
> 
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



___
sqlite-users mailing list
sqlite-users at mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



[sqlite] Under what circumstances can a table be locked when the database is first opened?

2015-05-23 Thread Barry Smith
Hi,

Unless you are using shared cache, SQLite does not lock on a per table level - 
only it locks the entire database.

Under what circumstances are you trying to access the database both times? Are 
these multiple connections within the same process or are you shutting down the 
process and then restarting? Do you have shared cached enabled?

Process Explorer is a windows tool that will tell you which process has open 
handles on a particular file. I found it a right pita to use though.

Cheers,

Barry

> On 23 May 2015, at 1:42 pm, "Keith Medcalf"  wrote:
> 
> 
> 1)  Something else has the database open and locked.
> 2)  You are using Shared Cache 
> 3)  Something forgot to finalize a select
> 4)  The database is stored on a non-locally-attached filesystem
> 5)  An issue in the version of SQLite you are using (and you did not say 
> which version you are using)
> 6)  A buggy filesystem driver (you did not say which one you are using)
> 7)  Badly designed antivirus software
> 8)  Badly designed file syncronization software (for example, storing the 
> database in a directory that is being monitored and synced by badly designed 
> software (dropbox for example)).
> 
>> -Original Message-
>> From: sqlite-users-bounces at mailinglists.sqlite.org [mailto:sqlite-users-
>> bounces at mailinglists.sqlite.org] On Behalf Of david at andl.org
>> Sent: Friday, 22 May, 2015 21:13
>> To: 'General Discussion of SQLite Database'
>> Subject: [sqlite] Under what circumstances can a table be locked when the
>> database is first opened?
>> 
>> Question: Under what circumstances can a table be locked when the database
>> is first opened?
>> 
>> My program does:
>> 
>> DROP TABLE IF EXISTS
>> CREATE TABLE
>> INSERT INTO (multiple times)
>> SELECT * (for each row)
>> 
>> Run it once and it works perfectly. Run it twice and the DROP TABLE
>> triggers
>> the error:
>> 
>> SQLITE_LOCKED, database table is locked
>> 
>> Delete the database and run it again and it works. Just once.
>> 
>> Nothing in the documentation tells me how a table can be locked when the
>> database is first opened. I'm using the raw C interface on Windows, so
>> what
>> can I be doing wrong?
>> 
>> The code is actually written in C#, but uses Interop to call the C API
>> directly. The database open code looks like this. No open flags are used.
>> 
>> LastResult = (Result)sqlite3_open(path, out _dbhandle);
>> 
>> Regards
>> David M Bennett FACS
>> 
>> Andl - A New Data Language - andl.org
>> 
>> 
>> ___
>> sqlite-users mailing list
>> sqlite-users at mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> 
> 
> 
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Under what circumstances can a table be locked when the database is first opened?

2015-05-23 Thread da...@andl.org
Question: Under what circumstances can a table be locked when the database
is first opened?

My program does:

DROP TABLE IF EXISTS
CREATE TABLE
INSERT INTO (multiple times)
SELECT * (for each row)

Run it once and it works perfectly. Run it twice and the DROP TABLE triggers
the error:

SQLITE_LOCKED, database table is locked

Delete the database and run it again and it works. Just once.

Nothing in the documentation tells me how a table can be locked when the
database is first opened. I'm using the raw C interface on Windows, so what
can I be doing wrong?

The code is actually written in C#, but uses Interop to call the C API
directly. The database open code looks like this. No open flags are used.

LastResult = (Result)sqlite3_open(path, out _dbhandle);

Regards
David M Bennett FACS

Andl - A New Data Language - andl.org




[sqlite] Under what circumstances can a table be locked when the database is first opened?

2015-05-23 Thread Simon Slavin

On 23 May 2015, at 4:13am, david at andl.org wrote:

> Run it once and it works perfectly. Run it twice and the DROP TABLE triggers
> the error:
> 
> SQLITE_LOCKED, database table is locked

I suspect Keith has it right.  To help you figure out which of his options is 
right,

Run it once.  Stay logged in for an hour.  Run it again.

Does it work now ?

Simon.


[sqlite] Under what circumstances can a table be locked when the database is first opened?

2015-05-22 Thread Keith Medcalf

1)  Something else has the database open and locked.
2)  You are using Shared Cache 
3)  Something forgot to finalize a select
4)  The database is stored on a non-locally-attached filesystem
5)  An issue in the version of SQLite you are using (and you did not say which 
version you are using)
6)  A buggy filesystem driver (you did not say which one you are using)
7)  Badly designed antivirus software
8)  Badly designed file syncronization software (for example, storing the 
database in a directory that is being monitored and synced by badly designed 
software (dropbox for example)).

> -Original Message-
> From: sqlite-users-bounces at mailinglists.sqlite.org [mailto:sqlite-users-
> bounces at mailinglists.sqlite.org] On Behalf Of david at andl.org
> Sent: Friday, 22 May, 2015 21:13
> To: 'General Discussion of SQLite Database'
> Subject: [sqlite] Under what circumstances can a table be locked when the
> database is first opened?
> 
> Question: Under what circumstances can a table be locked when the database
> is first opened?
> 
> My program does:
> 
> DROP TABLE IF EXISTS
> CREATE TABLE
> INSERT INTO (multiple times)
> SELECT * (for each row)
> 
> Run it once and it works perfectly. Run it twice and the DROP TABLE
> triggers
> the error:
> 
> SQLITE_LOCKED, database table is locked
> 
> Delete the database and run it again and it works. Just once.
> 
> Nothing in the documentation tells me how a table can be locked when the
> database is first opened. I'm using the raw C interface on Windows, so
> what
> can I be doing wrong?
> 
> The code is actually written in C#, but uses Interop to call the C API
> directly. The database open code looks like this. No open flags are used.
> 
> LastResult = (Result)sqlite3_open(path, out _dbhandle);
> 
> Regards
> David M Bennett FACS
> 
> Andl - A New Data Language - andl.org
> 
> 
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users