我应该如何使用并发sqlite 3访问来刷新数据 [英] What should I do to refresh data with concurrent sqlite 3 access

查看:88
本文介绍了我应该如何使用并发sqlite 3访问来刷新数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个sqlite windows客户端并发使用sqlite 3基础上的网络。当一个追加数据时,该记录被成功追加(目前没有日志文件)。但另一个客户端不会看到此记录,即使一个新的SELECT查询被触发,并开始看到这个表的一些SELECT查询之后从另一个表的此记录。

I have two sqlite windows clients concurrently using a sqlite 3 base on the network. When one appends data the record is successfully appended (there's no the journal file at the moment). But another client doesn't see this record even when a fresh SELECT query is fired and starts to see this record of this table after some SELECT queries from another table.

所以问题是:是否有官方方式来完全重置sqlite的内部缓冲区以刷新整个数据?

So the question is: is there the "official" way to reset internal buffers of sqlite completely to refresh whole data? Disconnecting from the DB would be a best bet, but maybe there's a way to do this without full disconnection?

推荐答案

使用SQLite over通过使用SQLite,可以在不完全断开连接的情况下,网络共享是一个危险的做法,由于网络文件共享软件在UNIX和Windows机器上的错误实施(导致SQLite锁定机制有时失败)。

Using SQLite over a network share is a dangerous practice due to the buggy implementations of network file sharing software on both UNIX and Windows machines (causing SQLite locking mechanism to fail sometimes).

如果您的数据库以这种方式损坏,请不要感到惊讶。

Don't be surprised if your database gets corrupted this way.

,我建议您更改软件以防止与SQLite使用网络共享。

So - regardless of your current problem, I'd advise you change your software to prevent using a network share with SQLite.

如果您仍然想使用网络共享解决方案 - 我建议您添加Synchronous =完整的pragma(或其等价物)到您正在使用的连接字符串,以使SQLite将所有内容同步刷新到磁盘。

If you still want to use the network share solution - I'd suggest you add Synchronous=Full pragma (or its equivalent) to the connection string you are using in order to make SQLite flush everything to disk synchronously.

这篇关于我应该如何使用并发sqlite 3访问来刷新数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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