Skip to main content
added 8 characters in body; edited title
Source Link
Paul White
  • 90.3k
  • 30
  • 424
  • 663

Getting Database is locked error in Sqlite DB

I have a query in which I am updating a table and have used ININ keyword in the query.

  The query is something like this  :

UPDATE q 
SET b_id = 123     
WHERE id IN (SELECT id FROM q WHERE b_id IS NULL LIMIT 1)

There is another query in which I am inserting data in table

he. The query is  :

INSERT INTO q (id, item) VALUES (@id, @item)

Both theThe queries are executing in differencton different threads, while executing 2nd query i.e. INSERTWhile executing the second (INSERT) query I am getting database is locked error.

What is the rasonreason?

TIAid is not primary key.

Getting Database is locked error in Sqlite DB

I have a query in which I am updating a table and have used IN keyword in the query.

  The query is something like this  :

UPDATE q 
SET b_id = 123     
WHERE id IN (SELECT id FROM q WHERE b_id IS NULL LIMIT 1)

There is another query in which I am inserting data in table

he query is  :

INSERT INTO q (id, item) VALUES (@id, @item)

Both the queries are executing in differenct threads, while executing 2nd query i.e. INSERT query I am getting database is locked error.

What is the rason?

TIA

Getting Database is locked error

I have a query in which I am updating a table and have used IN keyword in the query. The query is something like this:

UPDATE q 
SET b_id = 123     
WHERE id IN (SELECT id FROM q WHERE b_id IS NULL LIMIT 1)

There is another query in which I am inserting data in table. The query is:

INSERT INTO q (id, item) VALUES (@id, @item)

The queries are executing on different threads. While executing the second (INSERT) query I am getting database is locked error.

What is the reason?

id is not primary key.

added 240 characters in body; edited tags; edited title
Source Link

What Kind of a lock does Query having IN keyword takes? Getting Database is locked error in Sqlite DB

I have a query in which I am updating a table and have used IN keyword in the query.

The query is something like this :

UPDATE table1q set
SET fnameb_id = 'James'123      
WHERE id IN (SELECT id fromFROM table1q whereWHERE idb_id >IS NULL LIMIT 1)

There is another query in which I am inserting data in table

he query is :

INSERT INTO q (id, item) VALUES (@id, @item)

What kind of a lock will this whole quey take on aBoth the queries are executing in differenct threads, while executing 2nd query i.e. INSERT query I am getting database tableis locked error.

What is the rason?

TIA

What Kind of a lock does Query having IN keyword takes?

I have a query in which I am updating a table and have used IN keyword in the query.

The query is something like this :

UPDATE table1 set fname = 'James' WHERE id IN (SELECT id from table1 where id > 1 )

What kind of a lock will this whole quey take on a database table?

TIA

Getting Database is locked error in Sqlite DB

I have a query in which I am updating a table and have used IN keyword in the query.

The query is something like this :

UPDATE q 
SET b_id = 123      
WHERE id IN (SELECT id FROM q WHERE b_id IS NULL LIMIT 1)

There is another query in which I am inserting data in table

he query is :

INSERT INTO q (id, item) VALUES (@id, @item)

Both the queries are executing in differenct threads, while executing 2nd query i.e. INSERT query I am getting database is locked error.

What is the rason?

TIA

Source Link

What Kind of a lock does Query having IN keyword takes?

I have a query in which I am updating a table and have used IN keyword in the query.

The query is something like this :

UPDATE table1 set fname = 'James' WHERE id IN (SELECT id from table1 where id > 1 )

What kind of a lock will this whole quey take on a database table?

TIA