gpt4 book ai didi

database - 简单的多用户数据库解决方案

转载 作者:IT王子 更新时间:2023-10-29 06:23:06 28 4
gpt4 key购买 nike

我编写了一个 Windows 桌面应用程序,可以很好地与 Sqlite 配合使用。这是一个单用户应用程序,数据库就位于应用程序运行的机器上。

但是,该应用程序已经发展壮大,现在多个用户应该能够运行该应用程序并连接到一个共享数据库。

我希望能够在网络驱动器上共享 sqlite 文件,但这显然会导致数据损坏,除非有人有任何想法。

我想我可能需要安装数据库服务器,但商业 MySQL 许可证没有意义,PostgreSQL 非常不同,我不得不重写很多应用程序。我根本没有使用过 Firebird,所以我不确定这是否是一个好的解决方案。

是否可以安装任何 Sqlite 数据库服务器来处理 Sqlite 数据库文件上的传入事务?

如果我要求客户端自行下载安装MySQL,是否需要商业授权?

如果有任何建议或指导,那就太好了,谢谢。

最佳答案

您可以按照您的描述在共享网络驱动器上使用 Sqlite 文件,具体取决于底层文件系统:

http://www.sqlite.org/faq.html#q5

Multiple processes can have the same database open at the same time. Multiple processes can be doing a SELECT at the same time. But only one process can be making changes to the database at any moment in time, however.

SQLite uses reader/writer locks to control access to the database. (Under Win95/98/ME which lacks support for reader/writer locks, a probabilistic simulation is used instead.) But use caution: this locking mechanism might not work correctly if the database file is kept on an NFS filesystem. This is because fcntl() file locking is broken on many NFS implementations. You should avoid putting SQLite database files on NFS if multiple processes might try to access the file at the same time. On Windows, Microsoft's documentation says that locking may not work under FAT filesystems if you are not running the Share.exe daemon. People who have a lot of experience with Windows tell me that file locking of network files is very buggy and is not dependable. If what they say is true, sharing an SQLite database between two or more Windows machines might cause unexpected problems.

关于database - 简单的多用户数据库解决方案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1856313/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com