The method I have found works well and efficiently is to surround your Sqlite accesses with a semaphore and have accessing processes WAIT to get access to Sqlite. For best performance you would only block when an INSERT was in progress and let multiple SELECTs run concurrently.

This assumes that all your users go through the same interface so that they can co-operate.

The alternative is to put busy logic into your Sqlite code, but that is tedious and cannot be as efficient as synchronising using the more efficient kernel based method of a semaphore.

Since it is a single file and linked into the application Sqlite is essentially single user, requiring that only one process at a time modify the database. It has to use a file lock to enforce that constraint. If you work with it in your design you can transparently handle large numbers of users.

As you will already have appreciated, a multi-user Sqlite system must have short transactions to effectively share access. You might also look to making users who only read the database be read-only.

In an extreme case you could look to having database INSERTs be handled by a daemon which would single stream access.

Cesar David Rodas Maldonado wrote:
OK English is not my first language, i am from south America, from Paraguay
so i speak Spanish...

I am doing a project in C multiplataform.. right it project like google, for
a Linux.

the project uses SQ Lite for repository.

The software is a server which listen connection UDP. The server could index
(INSERT) and search within the database (SELECT).

The problem is when i do so much connection at the same time for do index
and search at the same time.

Know is it clear? sorry for my english :D

Thanxs



On 4/3/06, John Stanton <[EMAIL PROTECTED]> wrote:

Try to explain what you are doing.  How do you access SQLITE?  What
language?  What SQL are you using.  How many concurrent users do you
have?  Are you getting a LOCK error because of multiple users?

Cesar David Rodas Maldonado wrote:

please i need some help
On 4/3/06, Cesar David Rodas Maldonado <[EMAIL PROTECTED]> wrote:


i insert numbers and  select numbers, so what could be the solutions,
couse i have to do that


On 4/3/06, Pam Greene < [EMAIL PROTECTED]> wrote:


An INSERT can change the results of your SELECT, so the database has to

be
locked during INSERT.  Otherwise, the result of your SELECT would

depend

on
whether the INSERT had finished yet.  (The INSERT might even have only
partly finished, which would mean the SELECT was looking at a database
in an
inconsistent state.)  It's not good to have unpredictable results like
that.

For more explanation of why what you want isn't a good idea, see any
discussion of an "ACID" database, for example
http://en.wikipedia.org/wiki/ACID .

- Pam

On 4/3/06, Cesar David Rodas Maldonado <[EMAIL PROTECTED]> wrote:


HElp me, couse i just need to do insert and select, i dont use delete

or


replate or update

On 4/3/06, Cesar David Rodas Maldonado <[EMAIL PROTECTED] > wrote:


thanx man


but is posible open several DATABASE with a programm and do

transaccion


without locked the table???

On 4/3/06, Jay Sprenkle < [EMAIL PROTECTED]> wrote:



On 4/3/06, Cesar David Rodas Maldonado < [EMAIL PROTECTED]> wrote:


I have a database.... ok... i do a lot of insert and select, but

there


is


sometime that i cant do the select couse the database is

locked...


i have to do a lot of insert every time, so how can i do for

dont


lock


the


database...

understand guy?

Try this:
http://sqlite.org/lang_transaction.html






Reply via email to