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

发布于 2024-08-13 05:47:24 字数 417 浏览 10 评论 0原文

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

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

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

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

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

如果我需要客户端自行下载安装MySQL,我是否必须拥有商业许可证?

任何建议或方向都会很棒,谢谢。

I've written a Windows desktop application that works with Sqlite very nicely. It was a single user app, and the database sits right on the machine where the app runs.

However, the application has grown, and now multiple users should be able to run the app and connect to one shared database.

I'd like to just be able to share the sqlite file on a network drive, but that would obviously result in corrupted data unless someone has any ideas.

I guess I could require the install of a database server, but a commercial MySQL license doesn't make sense, PostgreSQL is different enough that I'd have to rewrite a lot of my application. I haven't worked with Firebird at all, so I'm not sure if that's a good solution or not.

Are there any Sqlite database servers that can be installed that handle the incoming transactions on the Sqlite database file?

If I require the client to download and install MySQL on their own, do I have to have a commercial license?

Any suggestions or direction would be great, thank you.

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

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

发布评论

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

评论(8

假装爱人 2024-08-20 05:47:24

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

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

多个进程可以有相同的
数据库同时打开。
多个进程可以同时执行一个操作
同时选择。但只有一个
过程可以进行更改
任何时刻的数据库,
然而。

SQLite 使用读/写锁来
控制对数据库的访问。 (在下面
Win95/98/ME 不支持
读/写锁,概率性的
而是使用模拟。)但是使用
注意:此锁定机制可能会
如果数据库无法正常工作
文件保存在 NFS 文件系统上。
这是因为 fcntl() 文件锁定
在许多 NFS 实现上都被破坏了。
你应该避免将 SQLite
NFS 上的数据库文件(如果有多个)
进程可能会尝试访问该文件
同时。在 Windows 上,
微软的文档说
锁定在 FAT 下可能不起作用
文件系统,如果您没有运行
Share.exe 守护进程。拥有一个
大量 Windows 经验告诉我
网络文件的文件锁定是
非常有问题而且不可靠。如果
他们说的是真的,分享
两个或多个之间的 SQLite 数据库
Windows 机器可能会导致
意想不到的问题。

You may be able to use the Sqlite file on a shared network drive as you described, depending on the underlying filesystem:

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.

青巷忧颜 2024-08-20 05:47:24

我认为 Firebird 可能是一个非常好的选择

  • 它是免费的
  • 嵌入式版本存在

I think that Firebird can be a very good choice

  • It's free
  • embedded version exist
又怨 2024-08-20 05:47:24

SQL Server Express 怎么样,它是免费的,应该会阻止你必须重写大部分代码,

What about SQL Server Express, its free and should stop you having to rewrite most of your code,

永不分离 2024-08-20 05:47:24

有一些 sqlite 服务器可以在多用户环境中使用 sqlite。阅读此处: http://www.sqlite.org/cvstrac/wiki?p=SqliteNetwork 。我不知道这些解决方案的性能和规模如何。

There are sqlite servers that make it possible to use sqlite in a multi user environment. Read here: http://www.sqlite.org/cvstrac/wiki?p=SqliteNetwork . I don't know how those solutions perform and scale.

几味少女 2024-08-20 05:47:24

我不知道为什么您认为如果将数据文件放在网络驱动器上并让应用程序的多个实例同时访问它,数据文件就会损坏。如果你主要是看书的话应该没问题。如果您进行大量写入,则可能会受到性能影响,因为只有一个实例可以同时写入。 (请参阅 http://www.sqlite.org/faq.html

如果您进行大量写入,您可能需要安装独立的服务器 - 您考虑过 MS SQL Server Express 吗?启动和运行应该简单易行。

I don't know why you assume that the data file will be corrupted if you put it on a network drive and let multiple instances of your app access it at the same time. If you do mainly reading, you should be alright. If you do a lot of writes, you will probably suffer a performance hit, since only one instance can write at the same time. (See http://www.sqlite.org/faq.html)

If you do a lot of writes, you probably will need a standalone server installation - have you considered MS SQL Server Express ? Should be easy and simple to get up and running.

烦人精 2024-08-20 05:47:24

我知道已经太晚了,但现在没有人需要在没有提供数据库抽象的框架的情况下编写应用程序。

我个人使用 Web2py,它是一个基于 python 的 Web 框架。默认情况下,它使用 SQLite,这非常适合本地桌面上的单用户应用程序或本地网络上主要是读取操作的中小型应用程序。但是,如果我决定增加应用程序的使用范围,我只需更改数据库模式中的连接字符串即可使用另一个数据库。 Web2py 或任何其他值得使用的框架只需重写 SQL 语句即可满足新的要求。

Too late I know, but no one these days should have a need to write an application without a framework that offers database abstraction.

Personally I use Web2py which is a python based Web Framework. By default it uses SQLite which is great for single user apps on the local desktop or small to medium apps on the local network which are mainly read operations. However if I decided to increase the scope of the app usage, I would simply change the connection string in the database modal to use another database. Web2py or any other framework worth using would simply rewrite the SQL statements to meet the new requirements.

幻想少年梦 2024-08-20 05:47:24

在您的连接字符串上使用此代码后,多个用户可以毫无问题地在您的数据库中插入、删除、选择等。

SQLiteConnection con = new SQLiteConnection("数据源=D:\yourdatabase.db;计数更改=关闭;日志模式=关闭;池化=true;缓存大小=10000;页面大小=4096;同步=关闭");

use this code on your connection string after that multiple user can insert,delete,select e.t.c. in your database without issue.

SQLiteConnection con = new SQLiteConnection("Data Source=D:\yourdatabase.db;Count Changes=off;Journal Mode=off;Pooling=true;Cache Size=10000;Page Size=4096;Synchronous=off");

困倦 2024-08-20 05:47:24

如果我需要客户端自行下载安装MySQL,我是否必须拥有商业许可证?

不会。MySQL

商业许可证的价值在于它允许您以二进制形式分发标准 MySQL 或修改版 MySQL,而无需分发源代码。它还可以让您获得支持。

但是,如果用户自己从 Oracle 获取 MySQL,则 GPL 不要求您向他们提供 MySQL 源代码。他们可以从 Oracle 获取它。事实上,Oracle 有义务提供它,只要它们按照 GPL 分发即可。

If I require the client to download and install MySQL on their own, do I have to have a commercial license?

No.

The value of a MySQL commercial license is that it allows you to distribute standard MySQL or a modified MySQL in binary form without the oblihation to also distribute source code. It also gives you access to support.

However, if the user obtains MySQL themselves from Oracle, the GPL places no obligations on you to provide them MySQL source code. They can get it from Oracle. Indeed, Oracle is obliged to provide it, so long as they distribute under the GPL.

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