I accidently ran into this situation and spent a couple of hours for finding the cause. In our environment we have a list of modules -> databases assignments. As it is possible that some modules share the database, they point to the same file. So we are attaching each module's database and the begin an exclusive transaction - bummer.

It would have been very elegant to reach the databases with an individual prefix (i.e. the module's name), and as those modules' count is variable, each of the modules would have been able to reach "its" database. We are mainly using this for an update process where we have to assure that the update process has exclusive access to all ever available databases.

The workaround for now is to take special care in what alias is first used for an attached database and to not attach an individual database more than once.

Michael


Am 18.09.2007 um 19:58 schrieb Samuel R. Neff:

I see the same behavior--begin exclusive causes db locked error when same db is attached twice. However, why would you want to attach the same database
twice?

SQLite version 3.4.2
Enter ".help" for instructions
sqlite> attach 'c.dat' as c1;
sqlite> attach 'c.dat' as c2;
sqlite> begin exclusive;
SQL error: database is locked
sqlite>

Sam


-----Original Message-----
From: Michael Plagge [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 18, 2007 12:58 PM
To: [email protected]
Subject: Re: [sqlite] Exclusive Transactions and Attached Databases

Just for interest: Am I the only one being faced with the quoted
situation and did I not understand the documentation, or is there
some misbehaviour in sqlite's handling of multiply attached database
files?

Thanks
Michael


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to