Re: [sqlite] WAL mode for in-memory databases?

2019-01-14 Thread Stephen Chrzanowski
That doesn't sound healthy at all.  If your application dies, what happens
to the database?  What if something rogue starts hitting it and just chews
up your memory?

IMO, Mem databases should be short lived and treated simply as an
intentional cache.  I get they're fast, but, long term life for a finite
resource isn't something I want kicking around when an application dies.

On Mon, Jan 14, 2019 at 1:43 PM Thomas Kurz  wrote:

> It would also be very helpful if more control about in-memory-databases
> was available. As far as I have understood, an in-memory database is
> deleted when the last connection closes. This requires me to always hold a
> connection to an in-memory database even if don't need it right now.
>
> Maybe one could introduce a pragma "persistent_inmemory" that allows to
> keep an in-memory-database until explicitely deleted. (DROP DATABASE IF
> EXISTS ...)
>
> ___
> 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


Re: [sqlite] SQLite error (5): database is locked

2019-01-14 Thread Simon Slavin
On 14 Jan 2019, at 7:04pm, Tim Streater  wrote:

> Hmm, from my attempt at interpreting the source code I gained the impression 
> that the handler used exponential backoff for the first few attempts, but 
> then used a constant period for the rest (up to the set limit). Is this not 
> the case?

I'm sure your interpretation is correct.  I just knew that the default handler 
used exponential backoff, and what that means.  I didn't know that it used it 
for every retry.  It seems likely that the dev team set a maximum based on 
their understanding of what lock times were plausible.

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


Re: [sqlite] SQLite error (5): database is locked

2019-01-14 Thread Tim Streater
On 14 Jan 2019, at 18:54, Simon Slavin  wrote:

> SQLite's own busy_timeout routine (the one you get if you don't supply your
> own) uses exponential backoff. It first sleeps for a very small amount of
> time, then checks the lock. If access is still prevented it sleeps longer,
> then checks again. Then longer still, then longer still, until the amount of
> time /since the routine started/ exceeds the timeout you set.

Hmm, from my attempt at interpreting the source code I gained the impression 
that the handler used exponential backoff for the first few attempts, but then 
used a constant period for the rest (up to the set limit). Is this not the case?


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


Re: [sqlite] SQLite error (5): database is locked

2019-01-14 Thread Simon Slavin
On 14 Jan 2019, at 6:34pm, Thomas Kurz  wrote:

>> pragma_busy_timeout
> 
> Does setting the busy_timeout retry periodically (e.g. every x milliseconds), 
> or is there some automatism that ensures that the requested operation is done 
> just-in-time as soon as the previous/blocking operation is finished?

The busy_timeout setting is the maximum amount of time that the busy_timeout 
routine is allowed to run.  That routine is not expected to sleep for that 
amount of time you set in a single sleep.

SQLite's own busy_timeout routine (the one you get if you don't supply your 
own) uses exponential backoff.  It first sleeps for a very small amount of 
time, then checks the lock.  If access is still prevented it sleeps longer, 
then checks again.  Then longer still, then longer still, until the amount of 
time /since the routine started/ exceeds the timeout you set.

The "just-in-time" idea mentioned in your question doesn't work in real life, 
since constantly checking mutex status keeps one core completely busy, using 
lots of power and generating lots of heat.

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


Re: [sqlite] WAL mode for in-memory databases?

2019-01-14 Thread Thomas Kurz
It would also be very helpful if more control about in-memory-databases was 
available. As far as I have understood, an in-memory database is deleted when 
the last connection closes. This requires me to always hold a connection to an 
in-memory database even if don't need it right now.

Maybe one could introduce a pragma "persistent_inmemory" that allows to keep an 
in-memory-database until explicitely deleted. (DROP DATABASE IF EXISTS ...)

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


Re: [sqlite] SQLite error (5): database is locked

2019-01-14 Thread Thomas Kurz
> pragma_busy_timeout

Does setting the busy_timeout retry periodically (e.g. every x milliseconds), 
or is there some automatism that ensures that the requested operation is done 
just-in-time as soon as the previous/blocking operation is finished?

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


Re: [sqlite] SQLite error (5): database is locked

2019-01-14 Thread Keith Medcalf

Are you getting as OS ERROR 5 or the SQLITE Return Code 5 (SQLITE_BUSY).  

The former means that the OS is indicating that the USERID you are using to run 
the task cannot open the file or the directory or the temporary files or the 
journal files required because it has not been granted the necessary 
permissions to do so; the latter indicates that the file has been opened but 
that you simply are trying to do something while the database is busy doing 
something else.

---
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.

>-Original Message-
>From: sqlite-users [mailto:sqlite-users-
>boun...@mailinglists.sqlite.org] On Behalf Of Urs Wagner
>Sent: Monday, 14 January, 2019 02:24
>To: SQLite mailing list
>Subject: [sqlite] SQLite error (5): database is locked
>
>Hallo
>
>I use several tasks in C# to call Sqlite queries.
>No I get the error SQLite error (5): database is locked.
>Is it not possible to use more than one tasks with Sqlite?
>
>Regards
>
>Urs
>___
>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


Re: [sqlite] [EXTERNAL] SQLite error (5): database is locked

2019-01-14 Thread Simon Slavin
On 14 Jan 2019, at 11:14am, Urs Wagner  wrote:

>ProviderConnectionString = @"data source=" + _dataBase + 
> ";PRAGMA foreign_keys = ON;PRAGMA locking_mode = EXCLUSIVE;PRAGMA 
> schema.synchronous = NORMAL; PRAGMA schema.journal_mode = DELETE; PRAGMA 
> busy_timeout = 10"

I am suspicious about this, but I do not know entity framework well enough to 
know for sure.  Can you include arbitrary PRAGMA statements in am entity 
framework connection string like this ?

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


Re: [sqlite] [EXTERNAL] SQLite error (5): database is locked

2019-01-14 Thread Urs Wagner
Thank You for Your explanation.
We do not using explicit transactions, SaveChanges takes rather a lot of time.


-Original Message-
From: sqlite-users  On Behalf Of 
Barry Smith
Sent: Monday, January 14, 2019 1:50 PM
To: SQLite mailing list 
Subject: Re: [sqlite] [EXTERNAL] SQLite error (5): database is locked

That's not how you set a busy timeout using a connection string. That's not how 
you set any (pragma) options with a connection string. Check the 
System.Data.SQLite documentation (or google) to find out connection string 
parameters, or play around with the SQLiteConnectionStringBuilder.

The busy timeout pragma will not help if you end up in a deadlock. One way a 
deadlock can occur is as follows:
 1) Connection A starts a transaction and reads the database - it takes out a 
shared lock
 2) Connection B starts a transaction and reads the database - it too takes out 
a shared lock
 3) Connection A attempts to write to the database, so it upgrades to a 
reserved lock and waits for all readers to close (all shared locks to be 
released).
 4) Connection B attempts to write to the database. It keeps its shared lock 
and tries to upgrade to reserved. Because A already owns a reserved lock, 
connection B is denied its lock. No amount of waiting will solve this problem 
because A is waiting for B to release its lock so it can have an exclusive 
lock. SQLite knows this, so it returns SQLITE_BUSY immediately.

https://www.sqlite.org/lockingv3.html

Note that the above is true for databases with an old style (non-WAL) journal. 
I assume similar protections and situations exist in WAL, but can't be certain 
and they may use a different mechanism.

You can figure out whether you have a deadlock or simply the wait timed out by 
looking at how quickly the error was returned. You can also look at where other 
threads (or processes if your debugger can attach to multiple processes) are 
when the error occurs.

Are you using explicit transactions? Entity Franework shouldn't cause deadlocks 
unless you are manually taking control of the transactions. EF can also take a 
very long time to SaveChanges if you have a large number of entities...

> On 14 Jan 2019, at 10:14 pm, Urs Wagner  wrote:
> 
> We are using entity framework
> 
> The timeout pragma does not work. Is think the timeout is not set, see below
> 
>var esb = new EntityConnectionStringBuilder
>{
>Metadata = 
> "res://*/RadaxModel.csdl|res://*/RadaxModel.ssdl|res://*/RadaxModel.msl",
>Provider = "System.Data.SQLite.EF6",
>ProviderConnectionString = @"data source=" + _dataBase + 
> ";PRAGMA foreign_keys = ON;PRAGMA locking_mode = EXCLUSIVE;PRAGMA 
> schema.synchronous = NORMAL; PRAGMA schema.journal_mode = DELETE; PRAGMA 
> busy_timeout = 10"
>};
> 
> 
> -Original Message-
> From: sqlite-users  On Behalf 
> Of Hick Gunter
> Sent: Monday, January 14, 2019 11:28 AM
> To: 'SQLite mailing list' 
> Subject: Re: [sqlite] [EXTERNAL] SQLite error (5): database is locked
> 
> With journal mode, SQLite supports 1 writer OR n readers; with WAL mode, 
> SQLite supports 1 writer AND N readers.
> 
> In any case, connections need to indicate if or how long they are willing to 
> wait for the db file to be unlocked. Default is NO.
> 
> The easiest way is to specify a timeout on the connection. The value needs to 
> be longer than your longest write transaction is expected to run and shorter 
> than the latency required by your application.
> 
> -Ursprüngliche Nachricht-
> Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im 
> Auftrag von Urs Wagner
> Gesendet: Montag, 14. Jänner 2019 10:24
> An: SQLite mailing list 
> Betreff: [EXTERNAL] [sqlite] SQLite error (5): database is locked
> 
> Hallo
> 
> I use several tasks in C# to call Sqlite queries.
> No I get the error SQLite error (5): database is locked.
> Is it not possible to use more than one tasks with Sqlite?
> 
> Regards
> 
> Urs
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> 
> 
> ___
> Gunter Hick | Software Engineer | Scientific Games International GmbH | 
> Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) 
> +43 1 80100 - 0
> 
> May be privileged. May be confidential. Please delete if not the addressee.
> ___
> 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
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlit

Re: [sqlite] WAL mode for in-memory databases?

2019-01-14 Thread Brian Macy
I’m very interested in the answer to this as I was planning on do the exact 
same thing.  Not sure my app would even be able to function without WAL mode.

Brian Macy

On Jan 14, 2019, 8:28 AM -0500, Dominique Devienne , wrote:
> On Mon, Jan 14, 2019 at 2:23 PM Wout Mertens  wrote:
>
> > AFAIK, your best bet is to put a file db on a ramdisk (tmpfs).
>
>
> That's not a very portable solution, and a work-around at best.
>
> I don't see anything technical that would prevent WAL to work for
> ":memory:".
> "Shared-memory" "in-process" is just memory about all...
> And mutexes already exists in SQLite to protected access when necessary.
>
> In-memory DBs are just so useful, and WAL is just so useful,
> I just don't see why we can't have both at the same time.
> Richard?
>
>
> > The ":memory:" DB is per connection only.
> >
>
> Not really. You can open the same :memory: DB
> from different connections in the same process, via URIs. --DD
> ___
> 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


Re: [sqlite] WAL mode for in-memory databases?

2019-01-14 Thread Dominique Devienne
On Mon, Jan 14, 2019 at 2:23 PM Wout Mertens  wrote:

> AFAIK, your best bet is to put a file db on a ramdisk (tmpfs).


That's not a very portable solution, and a work-around at best.

I don't see anything technical that would prevent WAL to work for
":memory:".
"Shared-memory" "in-process" is just memory about all...
And mutexes already exists in SQLite to protected access when necessary.

In-memory DBs are just so useful, and WAL is just so useful,
I just don't see why we can't have both at the same time.
Richard?


> The ":memory:" DB is per connection only.
>

Not really. You can open the same :memory: DB
from different connections in the same process, via URIs. --DD
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] WAL mode for in-memory databases?

2019-01-14 Thread Wout Mertens
AFAIK, your best bet is to put a file db on a ramdisk (tmpfs). The
":memory:" DB is per connection only.

Wout.


On Mon, Jan 14, 2019 at 11:37 AM Dominique Devienne 
wrote:

> According to [1] WAL mode does not apply to in-memory databases.
> But that's an old post, and not quite authoritative when not from the
> official SQLite docs.
>
> I'd like to benefit from the MVCC of WAL mode, but for an in-memory
> database,
> with different threads, each with its own connection, accessing a single
> in-memory DB.
>
> Can this do done? If not, why is WAL mode deemed not useful for in-memory?
> i.e. is there a work-around that makes WAL-mode in-memory superfluous?
> Or it's not superfluous and not supported, but could technically be
> supported?
>
> Thanks for any insights. --DD
>
> [1]
>
> https://stackoverflow.com/questions/28358153/sqlite-wal-mode-in-memory-database-with-private-cache
> ___
> 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


Re: [sqlite] [EXTERNAL] SQLite error (5): database is locked

2019-01-14 Thread Barry Smith
That's not how you set a busy timeout using a connection string. That's not how 
you set any (pragma) options with a connection string. Check the 
System.Data.SQLite documentation (or google) to find out connection string 
parameters, or play around with the SQLiteConnectionStringBuilder.

The busy timeout pragma will not help if you end up in a deadlock. One way a 
deadlock can occur is as follows:
 1) Connection A starts a transaction and reads the database - it takes out a 
shared lock
 2) Connection B starts a transaction and reads the database - it too takes out 
a shared lock
 3) Connection A attempts to write to the database, so it upgrades to a 
reserved lock and waits for all readers to close (all shared locks to be 
released).
 4) Connection B attempts to write to the database. It keeps its shared lock 
and tries to upgrade to reserved. Because A already owns a reserved lock, 
connection B is denied its lock. No amount of waiting will solve this problem 
because A is waiting for B to release its lock so it can have an exclusive 
lock. SQLite knows this, so it returns SQLITE_BUSY immediately.

https://www.sqlite.org/lockingv3.html

Note that the above is true for databases with an old style (non-WAL) journal. 
I assume similar protections and situations exist in WAL, but can't be certain 
and they may use a different mechanism.

You can figure out whether you have a deadlock or simply the wait timed out by 
looking at how quickly the error was returned. You can also look at where other 
threads (or processes if your debugger can attach to multiple processes) are 
when the error occurs.

Are you using explicit transactions? Entity Franework shouldn't cause deadlocks 
unless you are manually taking control of the transactions. EF can also take a 
very long time to SaveChanges if you have a large number of entities...

> On 14 Jan 2019, at 10:14 pm, Urs Wagner  wrote:
> 
> We are using entity framework
> 
> The timeout pragma does not work. Is think the timeout is not set, see below
> 
>var esb = new EntityConnectionStringBuilder
>{
>Metadata = 
> "res://*/RadaxModel.csdl|res://*/RadaxModel.ssdl|res://*/RadaxModel.msl",
>Provider = "System.Data.SQLite.EF6",
>ProviderConnectionString = @"data source=" + _dataBase + 
> ";PRAGMA foreign_keys = ON;PRAGMA locking_mode = EXCLUSIVE;PRAGMA 
> schema.synchronous = NORMAL; PRAGMA schema.journal_mode = DELETE; PRAGMA 
> busy_timeout = 10"
>};
> 
> 
> -Original Message-
> From: sqlite-users  On Behalf 
> Of Hick Gunter
> Sent: Monday, January 14, 2019 11:28 AM
> To: 'SQLite mailing list' 
> Subject: Re: [sqlite] [EXTERNAL] SQLite error (5): database is locked
> 
> With journal mode, SQLite supports 1 writer OR n readers; with WAL mode, 
> SQLite supports 1 writer AND N readers.
> 
> In any case, connections need to indicate if or how long they are willing to 
> wait for the db file to be unlocked. Default is NO.
> 
> The easiest way is to specify a timeout on the connection. The value needs to 
> be longer than your longest write transaction is expected to run and shorter 
> than the latency required by your application.
> 
> -Ursprüngliche Nachricht-
> Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im 
> Auftrag von Urs Wagner
> Gesendet: Montag, 14. Jänner 2019 10:24
> An: SQLite mailing list 
> Betreff: [EXTERNAL] [sqlite] SQLite error (5): database is locked
> 
> Hallo
> 
> I use several tasks in C# to call Sqlite queries.
> No I get the error SQLite error (5): database is locked.
> Is it not possible to use more than one tasks with Sqlite?
> 
> Regards
> 
> Urs
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> 
> 
> ___
> Gunter Hick | Software Engineer | Scientific Games International GmbH | 
> Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) 
> +43 1 80100 - 0
> 
> May be privileged. May be confidential. Please delete if not the addressee.
> ___
> 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
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] [EXTERNAL] SQLite error (5): database is locked

2019-01-14 Thread Hick Gunter
Please note the the semicolon at the end of an SQL Statement is required. 
"PRAGMA busy_timeout = 100" is not complete SQL.
Also, the schema prefix needs to be replaced with the attach name of the 
database whose properties you wish to query/change. It may be omitted if "main" 
is desired.

-Ursprüngliche Nachricht-
Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im 
Auftrag von Urs Wagner
Gesendet: Montag, 14. Jänner 2019 12:14
An: SQLite mailing list 
Betreff: Re: [sqlite] [EXTERNAL] SQLite error (5): database is locked

We are using entity framework

The timeout pragma does not work. Is think the timeout is not set, see below

var esb = new EntityConnectionStringBuilder
{
Metadata = 
"res://*/RadaxModel.csdl|res://*/RadaxModel.ssdl|res://*/RadaxModel.msl",
Provider = "System.Data.SQLite.EF6",
ProviderConnectionString = @"data source=" + _dataBase + 
";PRAGMA foreign_keys = ON;PRAGMA locking_mode = EXCLUSIVE;PRAGMA 
schema.synchronous = NORMAL; PRAGMA schema.journal_mode = DELETE; PRAGMA 
busy_timeout = 10"
};


-Original Message-
From: sqlite-users  On Behalf Of 
Hick Gunter
Sent: Monday, January 14, 2019 11:28 AM
To: 'SQLite mailing list' 
Subject: Re: [sqlite] [EXTERNAL] SQLite error (5): database is locked

With journal mode, SQLite supports 1 writer OR n readers; with WAL mode, SQLite 
supports 1 writer AND N readers.

In any case, connections need to indicate if or how long they are willing to 
wait for the db file to be unlocked. Default is NO.

The easiest way is to specify a timeout on the connection. The value needs to 
be longer than your longest write transaction is expected to run and shorter 
than the latency required by your application.

-Ursprüngliche Nachricht-
Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im 
Auftrag von Urs Wagner
Gesendet: Montag, 14. Jänner 2019 10:24
An: SQLite mailing list 
Betreff: [EXTERNAL] [sqlite] SQLite error (5): database is locked

Hallo

I use several tasks in C# to call Sqlite queries.
No I get the error SQLite error (5): database is locked.
Is it not possible to use more than one tasks with Sqlite?

Regards

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


___
 Gunter Hick | Software Engineer | Scientific Games International GmbH | 
Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 
1 80100 - 0

May be privileged. May be confidential. Please delete if not the addressee.
___
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


___
 Gunter Hick | Software Engineer | Scientific Games International GmbH | 
Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 
1 80100 - 0

May be privileged. May be confidential. Please delete if not the addressee.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] [EXTERNAL] SQLite error (5): database is locked

2019-01-14 Thread Urs Wagner
We are using entity framework

The timeout pragma does not work. Is think the timeout is not set, see below

var esb = new EntityConnectionStringBuilder
{
Metadata = 
"res://*/RadaxModel.csdl|res://*/RadaxModel.ssdl|res://*/RadaxModel.msl",
Provider = "System.Data.SQLite.EF6",
ProviderConnectionString = @"data source=" + _dataBase + 
";PRAGMA foreign_keys = ON;PRAGMA locking_mode = EXCLUSIVE;PRAGMA 
schema.synchronous = NORMAL; PRAGMA schema.journal_mode = DELETE; PRAGMA 
busy_timeout = 10"
};


-Original Message-
From: sqlite-users  On Behalf Of 
Hick Gunter
Sent: Monday, January 14, 2019 11:28 AM
To: 'SQLite mailing list' 
Subject: Re: [sqlite] [EXTERNAL] SQLite error (5): database is locked

With journal mode, SQLite supports 1 writer OR n readers; with WAL mode, SQLite 
supports 1 writer AND N readers.

In any case, connections need to indicate if or how long they are willing to 
wait for the db file to be unlocked. Default is NO.

The easiest way is to specify a timeout on the connection. The value needs to 
be longer than your longest write transaction is expected to run and shorter 
than the latency required by your application.

-Ursprüngliche Nachricht-
Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im 
Auftrag von Urs Wagner
Gesendet: Montag, 14. Jänner 2019 10:24
An: SQLite mailing list 
Betreff: [EXTERNAL] [sqlite] SQLite error (5): database is locked

Hallo

I use several tasks in C# to call Sqlite queries.
No I get the error SQLite error (5): database is locked.
Is it not possible to use more than one tasks with Sqlite?

Regards

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


___
 Gunter Hick | Software Engineer | Scientific Games International GmbH | 
Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 
1 80100 - 0

May be privileged. May be confidential. Please delete if not the addressee.
___
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


[sqlite] WAL mode for in-memory databases?

2019-01-14 Thread Dominique Devienne
According to [1] WAL mode does not apply to in-memory databases.
But that's an old post, and not quite authoritative when not from the
official SQLite docs.

I'd like to benefit from the MVCC of WAL mode, but for an in-memory
database,
with different threads, each with its own connection, accessing a single
in-memory DB.

Can this do done? If not, why is WAL mode deemed not useful for in-memory?
i.e. is there a work-around that makes WAL-mode in-memory superfluous?
Or it's not superfluous and not supported, but could technically be
supported?

Thanks for any insights. --DD

[1]
https://stackoverflow.com/questions/28358153/sqlite-wal-mode-in-memory-database-with-private-cache
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] [EXTERNAL] SQLite error (5): database is locked

2019-01-14 Thread Hick Gunter
With journal mode, SQLite supports 1 writer OR n readers; with WAL mode, SQLite 
supports 1 writer AND N readers.

In any case, connections need to indicate if or how long they are willing to 
wait for the db file to be unlocked. Default is NO.

The easiest way is to specify a timeout on the connection. The value needs to 
be longer than your longest write transaction is expected to run and shorter 
than the latency required by your application.

-Ursprüngliche Nachricht-
Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im 
Auftrag von Urs Wagner
Gesendet: Montag, 14. Jänner 2019 10:24
An: SQLite mailing list 
Betreff: [EXTERNAL] [sqlite] SQLite error (5): database is locked

Hallo

I use several tasks in C# to call Sqlite queries.
No I get the error SQLite error (5): database is locked.
Is it not possible to use more than one tasks with Sqlite?

Regards

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


___
 Gunter Hick | Software Engineer | Scientific Games International GmbH | 
Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 
1 80100 - 0

May be privileged. May be confidential. Please delete if not the addressee.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite error (5): database is locked

2019-01-14 Thread Simon Slavin
On 14 Jan 2019, at 9:23am, Urs Wagner  wrote:

> I use several tasks in C# to call Sqlite queries.
> No I get the error SQLite error (5): database is locked.
> Is it not possible to use more than one tasks with Sqlite?

Please set a timeout for all connections to your database:





A good timeout value is at least 1 milliseconds.

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


[sqlite] SQLite error (5): database is locked

2019-01-14 Thread Urs Wagner
Hallo

I use several tasks in C# to call Sqlite queries.
No I get the error SQLite error (5): database is locked.
Is it not possible to use more than one tasks with Sqlite?

Regards

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