我们可以从多个 Flex 应用程序访问单个 SQLite 数据库吗?

发布于 2024-11-30 15:00:54 字数 243 浏览 1 评论 0原文

是否可以从 Flex 的多个客户端应用程序(Web 和 AIR 应用程序)同时访问服务器上的单个 SQLite 数据库?

数据库有锁吗?

我想要做的是,我想将数据存储在服务器端的 SQLite 数据库中,并且希望 Web 和 AIR 中的 Flex 应用程序可以同时从服务器上的同一数据库中获取数据。

这可以通过 SQLite 和 Flex 应用程序实现吗?

在 Flex 中是否有更好的方法来实现这一目标?

Is it possible to simultaneously access single SQLite database at server from multiple clients applications of Flex(web and AIR applications)?

Is there any locking of database?

What i am trying todo is, i want to store my data in SQLite database at server side and i want that Flex applications both in web and AIR can simultaneously fetch data from the same database at server.

Is this possible to achieve with SQLite and Flex applications?

Is there any Better way to achieve this in Flex?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情丝乱 2024-12-07 15:00:54

我最近在 SQLite 和并发性方面做了很多努力。这有点麻烦,但它是可行的。

问题是,当您向 SQLite 数据库发出写入时,您会锁定整个事物(与其他解决方案支持的行锁定相比)。如果您从多个位置/线程发出大量写入,那么当出现“数据库锁定”错误时,您将会遇到困难。

我认为可以增加 SQLite 查询的超时时间,这样这些问题就会变得……稍微小的问题。尽管如此,它们仍然是问题。

使用 SQLite 时可能遇到的另一个问题是使用 FOR UPDATE。当您需要检索某些行,计算给定数据的内容,然后发出更新而无需其他查询同时读取这些行时,可以使用此方法。它不支持这样的构造。您可以绕过它,但在执行此更新时必须显式锁定整个数据库(您会看到有人解决此问题此处)。

并发读取很好,所以也许它对你有用。

我想这整件事的要点在于,它取决于您期望数据库上有多少并发命中。如果您期望很多,也许您应该考虑一个更强大的数据库解决方案,例如 postgresql

无论如何,我不是数据库专家,但我希望这能为您指明正确的方向。

I've recently been doing quite a bit of wrestling with SQLite and concurrency. It's sort of a bitch, but it IS doable.

The issue is, when you issue writes to a SQLite database you lock the entire thing (in comparison to row locking, which other solutions support). If you're issuing tons of writes from multiple locations/threads, you're going to wind up hitting walls when 'database locked' errors show up.

I think it's possible to increase the timeout on SQLite queries so these issues become... slightly smaller issues. They are still issues nonetheless.

Another issue you may run into with SQLite is using FOR UPDATE. This is used when you need to retrieve some rows, compute things given the data, then issue an update without other queries reading those rows in the meantime. It does not support such a construct. You can get around it, but you have to explicitly lock the entire database while you do this update (you'll see someone addressing this here).

Concurrent reads are fine, so maybe it will work for you.

I suppose the TL;DR of this whole thing is that it depends on how many concurrent hits you expect to be having on the database. If you expect a lot, perhaps you should look into a more robust database solution like postgresql.

I'm not a database expert by any means, but I hope that points you in the right direction.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文