Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
尝试打开与多个进程的连接时发生SQLite异常_Sqlite_Delphi_Delphi 10 Seattle_Firedac - Fatal编程技术网

尝试打开与多个进程的连接时发生SQLite异常

尝试打开与多个进程的连接时发生SQLite异常,sqlite,delphi,delphi-10-seattle,firedac,Sqlite,Delphi,Delphi 10 Seattle,Firedac,我的场景很简单,我有一个进程生成一些数据并将其放入数据库(当前在最后一个完成后5秒),然后有任意数量的进程打开连接以读取单个记录以供内部使用(当前在最后一个完成后5秒)。数据库位于本地驱动器上,操作系统为Windows Server 2012 R2 在读卡器进程中,连接到sqlite数据库时,我偶尔会收到一个错误,当连接打开时,会出现一个[FireDAC][Phys][sqlite]错误:由于未完成的语句或未完成的备份而无法关闭异常被抛出,我对错误消息的原因和含义感到困惑(在打开连接的情况下)

我的场景很简单,我有一个进程生成一些数据并将其放入数据库(当前在最后一个完成后5秒),然后有任意数量的进程打开连接以读取单个记录以供内部使用(当前在最后一个完成后5秒)。数据库位于本地驱动器上,操作系统为Windows Server 2012 R2

在读卡器进程中,连接到sqlite数据库时,我偶尔会收到一个错误,当连接打开时,会出现一个
[FireDAC][Phys][sqlite]错误:由于未完成的语句或未完成的备份而无法关闭
异常被抛出,我对错误消息的原因和含义感到困惑(在打开连接的情况下)

我的连接是这样创建的(在reader和writer应用程序中):

在调查抛出的
efddbengineeexception
之后,错误列表中只有一个错误,它包含
ErrorCode=5
,也就是说是
SQLITE\u BUSY
错误

调查调用堆栈

ntdll.dll                    KiUserExceptionDispatcher
FireDAC.Phys.SQLite          TFDPhysSQLiteConnection.InternalDisconnect
FireDAC.Phys                 TFDPhysConnection.ConnectBase
ntdll.dll                    KiUserExceptionDispatcher
FireDAC.Phys.SQLiteWrapper   TSQLiteStatement.PrepareBase
FireDAC.Phys.SQLiteWrapper   TSQLiteStatement.Prepare
FireDAC.Phys.SQLiteWrapper   TSQLiteStatement.Prepare
FireDAC.Phys.SQLite          TFDPhysSQLiteConnection.InternalExecuteDirect
FireDAC.Phys.SQLite          SetPragma
FireDAC.Phys.SQLite          TFDPhysSQLiteConnection.InternalConnect
FireDAC.Phys                 TFDPhysConnection.ConnectBase
FireDAC.Phys                 TFDPhysConnection.DoConnect
FireDAC.Phys                 TFDPhysConnection.Open
FireDAC.Comp.Client          TFDCustomConnection.DoInternalLogin
FireDAC.Comp.Client          TFDCustomConnection.DoLogin
FireDAC.Comp.Client          TFDCustomConnection.DoConnect
Data.DB                      TCustomConnection.SetConnected
FireDAC.Comp.Client          TFDCustomConnection.SetConnected
Data.DB                      TCustomConnection.Open
显然,它不喜欢在
TSQLiteStatement.PrepareBase
中发生的事情,这会导致
TFDPhysConnection.ConnectBase
尝试清理创建连接的任何点,但未完成的语句会在哪里

Close()
Free()
完成每个TFDQuery和连接

我错过了什么?


另请注意,因为这对我来说是个问题。一旦发生错误,WAL和SHM文件不会折叠到数据库文件中,如果我尝试在我的开发人员计算机上的调试器下运行读卡器应用程序,指向共享文件夹中的数据库,则在尝试打开连接并结束所有其他读卡器和写入程序进程没有解锁它,然后我需要重新启动我的开发计算机。

您不能与网络文件系统一起使用。至于错误消息,它表明某些连接对象无法关闭;某些读取是否使用多个连接?嘿,感谢您的建议,您是否有不将WAL与网络文件系统一起使用的参考资料ile系统?阅读更多内容会很有趣,我认为我的开发人员机器锁定与网络文件系统锁定有关:(.此外,所有进程都会创建一个连接,使用它来完成任务,然后关闭它,等待x个时间段,然后重复。因此,我很有信心,在任何时候,每个进程都只有一个到数据库的连接。蓝色文本是一个链接;您可以单击它。错误消息说某些查询没有关闭。哦,没有注意到,ch每个人都设置了
SQLiteAdvanced
参数。参数应该是
SQLiteAdvanced=temp\u store=MEMORY;page\u size=4096;auto\u vacuum=FULL
ntdll.dll                    KiUserExceptionDispatcher
FireDAC.Phys.SQLite          TFDPhysSQLiteConnection.InternalDisconnect
FireDAC.Phys                 TFDPhysConnection.ConnectBase
ntdll.dll                    KiUserExceptionDispatcher
FireDAC.Phys.SQLiteWrapper   TSQLiteStatement.PrepareBase
FireDAC.Phys.SQLiteWrapper   TSQLiteStatement.Prepare
FireDAC.Phys.SQLiteWrapper   TSQLiteStatement.Prepare
FireDAC.Phys.SQLite          TFDPhysSQLiteConnection.InternalExecuteDirect
FireDAC.Phys.SQLite          SetPragma
FireDAC.Phys.SQLite          TFDPhysSQLiteConnection.InternalConnect
FireDAC.Phys                 TFDPhysConnection.ConnectBase
FireDAC.Phys                 TFDPhysConnection.DoConnect
FireDAC.Phys                 TFDPhysConnection.Open
FireDAC.Comp.Client          TFDCustomConnection.DoInternalLogin
FireDAC.Comp.Client          TFDCustomConnection.DoLogin
FireDAC.Comp.Client          TFDCustomConnection.DoConnect
Data.DB                      TCustomConnection.SetConnected
FireDAC.Comp.Client          TFDCustomConnection.SetConnected
Data.DB                      TCustomConnection.Open