使用来自多个线程的多个连接 - SQLITE_LOCKED [英] Using multiple connections from multiple threads - SQLITE_LOCKED

查看:97
本文介绍了使用来自多个线程的多个连接 - SQLITE_LOCKED的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。

当数据库处于序列化模式,启用wal并关闭共享缓存模式时,使用多个数据库连接是否合法。另外我想打开连接并从几个线程中使用它们。我一直收到SQLITE_LOCKED错误,并且当来自另一个连接的写入事务正在进行时无法从db读取。



我不会尝试同时使用多个线程的相同连接。



问候

解决方案

为了清楚 - 你有多个线程,EACH线程有自己的OWN连接?



如果没有,那么无论数据库正在做什么,我都担心这是问题。




是的,每个线程都有自己的连接。 / BLOCKQUOTE>

Hi.
Is it legal to use multiple connections to a database when the db is in serialized mode, wal is enabled and shared cache mode is off. Additionally i would like to open the connections and use them from several threads. I keep getting SQLITE_LOCKED errors and cannot read from the db when a write transaction from another connection is ongoing.

I do not try to use the same connection from multiple threads at the same time.

Regards

解决方案

Just to be clear - you have multiple threads and EACH thread has its OWN connection?

If not then far as I am concerned that is problem regardless of what the database is doing.


Hi,
yes, each thread has its own connection.


这篇关于使用来自多个线程的多个连接 - SQLITE_LOCKED的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆