简单的多用户数据库解决方案
我编写了一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
您可以按照您的描述使用共享网络驱动器上的 Sqlite 文件,具体取决于底层文件系统:
http://www.sqlite.org/faq.html#q5
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
我认为 Firebird 可能是一个非常好的选择
I think that Firebird can be a very good choice
SQL Server Express 怎么样,它是免费的,应该会阻止你必须重写大部分代码,
What about SQL Server Express, its free and should stop you having to rewrite most of your code,
有一些 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.
我不知道为什么您认为如果将数据文件放在网络驱动器上并让应用程序的多个实例同时访问它,数据文件就会损坏。如果你主要是看书的话应该没问题。如果您进行大量写入,则可能会受到性能影响,因为只有一个实例可以同时写入。 (请参阅 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.
我知道已经太晚了,但现在没有人需要在没有提供数据库抽象的框架的情况下编写应用程序。
我个人使用 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.
在您的连接字符串上使用此代码后,多个用户可以毫无问题地在您的数据库中插入、删除、选择等。
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");
不会。MySQL
商业许可证的价值在于它允许您以二进制形式分发标准 MySQL 或修改版 MySQL,而无需分发源代码。它还可以让您获得支持。
但是,如果用户自己从 Oracle 获取 MySQL,则 GPL 不要求您向他们提供 MySQL 源代码。他们可以从 Oracle 获取它。事实上,Oracle 有义务提供它,只要它们按照 GPL 分发即可。
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.