database 在 Delphi 应用程序中使用哪个嵌入式数据库?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/222699/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 07:02:15  来源:igfitidea点击:

Which embedded database to use in a Delphi application?

databasedelphidesktopembedded-database

提问by Darrel

I am creating a desktop app in Delphi and plan to use an embedded database. I've started the project using SQlite3 with the DISQLite3 library. It works but documentation seems a bit light. I recently found Firebird (yes I've been out of Windows for a while) and it seems to have some compelling features and support.

我正在 Delphi 中创建一个桌面应用程序并计划使用嵌入式数据库。我已经开始使用带有 DISQLite3 库的 SQlite3 的项目。它有效,但文档似乎有点轻。我最近发现了 Firebird(是的,我已经离开 Windows 一段时间了),它似乎有一些引人注目的功能和支持。

What are some pros and cons of each embedded db? Size is important as well as support and resources. What have you used and why?

每个嵌入式数据库的优缺点是什么?规模与支持和资源一样重要。你用过什么,为什么?

采纳答案by Nick Bradbury

I've been using SQLite (via DISQLite3) in FeedDemon for several months, and I highly recommend it - it has been extremely fast and stable. As Javier said, the docs for the library may be thin, but the docs for SQLite itself are very good.

我已经在 FeedDemon 中使用 SQLite(通过 DISQLite3)几个月了,我强烈推荐它 - 它非常快速和稳定。正如 Javier 所说,该库的文档可能很少,但 SQLite 本身的文档非常好。

回答by gabr

I'm using Firebird 2.1 Embedded and I'm quite happy with it.I like the fact that the database size is practically unlimited (tested with > 4 GB databases and it works) and that the database file is compatible with the Firebird Server so I can use standard tools for database management and inspection. Distribution consists of dropping few files in your exe folder.

我正在使用 Firebird 2.1 Embedded,我对它非常满意。我喜欢这样一个事实,即数据库大小几乎不受限制(使用 > 4 GB 的数据库进行测试并且可以正常工作)并且数据库文件与 Firebird 服务器兼容,因此我可以使用标准工具进行数据库管理和检查。分发包括在您的 exe 文件夹中删除几个文件。

Simultaneous access from multiple programs is not supported but simultaneous access from multiple threads is (as long as you ensure that only one 'connect' operation is in progress at any given moment).

不支持来自多个程序的同时访问,但支持来自多个线程的同时访问(只要您确保在任何给定时刻只有一个“连接”操作正在进行)。

回答by Lou Franco

I have used SQlite3 for a lot of projects (but from C/C++ and Objective-C). It's extremely small -- no dependencies whatsoever -- database is in a single file.

我已经将 SQlite3 用于很多项目(但来自 C/C++ 和 Objective-C)。它非常小——没有任何依赖——数据库在一个文件中。

It's the db of choice for Mac developers because it's directly supported by CoreData and on the iPhone -- so there is a big user base (not to mention all of the other users).

它是 Mac 开发人员的首选数据库,因为 CoreData 和 iPhone 直接支持它——因此有一个庞大的用户群(更不用说所有其他用户了)。

回答by Jim McKeeth

I've used DBISAMon a number of projects. It is completely embedded without even a need for an external DLL. Unlike the others you listed it is commercial. A lot of great features though and very well documented and supported. The have a successorto it that I haven't tried yet though.

我已经在许多项目中使用过DBISAM。它是完全嵌入的,甚至不需要外部 DLL。与您列出的其他产品不同,它是商业用途。虽然有很多很棒的功能,并且有很好的文档和支持。有一个我还没有尝试过的继任者

回答by Max Lybbert

Let's see, quick comparison:

让我们看看,快速比较:

SQLite:

SQLite:

  • dynamic typing in the database
  • cross-platform files
  • runs on Windows, Linux, Mac, etc.
  • public domain
  • supports transactions
  • relies on file system security, does not include own security
  • 数据库中的动态类型
  • 跨平台文件
  • 在 Windows、Linux、Mac 等上运行。
  • 公共区域
  • 支持交易
  • 依赖于文件系统安全,不包括自身安全

Firebird embedded:

火鸟嵌入:

  • strong typing in the database
    • not all SQL datatypes are supported
  • cross-platform files
    • Firebird embedded only runs on Windows
    • Files from Firebird embedded are in the same format as the full server version
    • Files from Firebird embedded can be copied to a non-Windows server for use
  • available under a modified MPL ("what's ours is ours and must remain free, what's yours is yours and you don't have to release it")
  • supports transactions, triggers, etc.
  • 数据库中的强类型
    • 并非所有 SQL 数据类型都受支持
  • 跨平台文件
    • 嵌入式 Firebird 仅在 Windows 上运行
    • 嵌入 Firebird 的文件与完整服务器版本的格式相同
    • Firebird 内嵌的文件可以复制到非 Windows 服务器上使用
  • 在修改后的 MPL 下可用(“我们的就是我们的,必须保持免费,你的就是你的,你不必发布它”)
  • 支持事务、触发器等。

MySQL embedded:

嵌入式 MySQL:

  • support for SQL features depends on file format
  • (IIRC) cross-platform files
  • GPL unless you pay royalties
  • runs on Windows, Linux, Mac
  • incredibly popular with the open source crowd
  • 对 SQL 功能的支持取决于文件格式
  • (IIRC) 跨平台文件
  • GPL 除非你支付版税
  • 在 Windows、Linux、Mac 上运行
  • 在开源人群中非常受欢迎

Even embedded databases have their strengths and weaknesses. You'll need to weigh those strengths and weaknesses against what you're doing to decide.

即使是嵌入式数据库也有其优点和缺点。你需要权衡这些优势和劣势与你正在做的决定。

回答by Max Lybbert

Firebird embedded is our #1 choice because with no code changes, a single user Delphi app with embedded database can be migrated to a multi-user server based deployment without sacrificing any of the high end features (such as stored procedures, triggers, views, etc.). And its a TRUE free database and doesn't GPL your code in the process.

Firebird 嵌入式是我们的第一选择,因为无需更改代码,带有嵌入式数据库的单用户 Delphi 应用程序可以迁移到基于多用户服务器的部署,而不会牺牲任何高端功能(例如存储过程、触发器、视图、等等。)。它是一个真正的免费数据库,并且不会在此过程中对您的代码进行 GPL。

回答by tomo7

Strongly recommend to use AnyDAC when working with Databases and Delphi - then you can choose to target FB or SQLite seamlessingly.

强烈建议在使用数据库和 Delphi 时使用 AnyDAC - 然后您可以选择无缝定位 FB 或 SQLite。

My preference would be for FB for embedded apps. Tom

我更喜欢嵌入式应用程序的 FB。汤姆

回答by vrad

It really depends what you need. For single-user applications, Firebird Embedded or SQLite are probably best choices (and price is right). On the other end, if you need support for large number of multiple users, you should probably use regular Firebird instead of Embedded version (server is simple to install so you won't have much problems here).

这真的取决于你需要什么。对于单用户应用程序,Firebird Embedded 或 SQLite 可能是最佳选择(而且价格合适)。另一方面,如果您需要支持大量多用户,您可能应该使用常规 Firebird 而不是嵌入式版本(服务器安装简单,因此您不会在这里遇到太多问题)。

And if you need something in between, for a moderate multi-user application, one of flat databases would be better. I found that ComponentAce's Absolute Databasebetter choice for my needs than DBISAM, NexusDB or VistaDB.

如果您需要介于两者之间的东西,对于中等的多用户应用程序,平面数据库之一会更好。我发现ComponentAce 的绝对数据库比 DBISAM、NexusDB 或 VistaDB 更能满足我的需求。

It leaves relatively small footprint (no DLLs), it's a single-file db (a must for me), supports Unicode, BLOB compression, crypting, and technical limits seem impressing for a flat database. Moreover, support was good in few occasions when I needed it.

它占用的空间相对较小(没有 DLL),它是一个单文件数据库(对我来说是必须的),支持 Unicode、BLOB 压缩、加密,并且技术限制对于平面数据库来说似乎令人印象深刻。此外,在我需要的少数情况下,支持是很好的。

For cons, I have noticed it doesn't support nested transactions, but other than that, I had no problems.

对于缺点,我注意到它不支持嵌套事务,但除此之外,我没有任何问题。

回答by Jeremy Mullin

I use Sybase's Advantage Database Server, but I'm also the R&D Manager, so this post is biased. :)

我用的是Sybase的Advantage Database Server,但我也是研发经理,所以这个帖子有偏见。:)

We have native Delphi TTable and TQuery components for both WIN32 VCL and VCL.NET. Direct table access in addition to SQL support makes Advantage unique among many of the other Delphi offerings. Advantage supports large tables (only limited by the number of records, 2 billion) and has a free local engine, which is nice for development PCs and for small customer sites that don't require client/server functionality. Switch to client/server with a single connection property, no other changes.

我们有适用于 WIN32 VCL 和 VCL.NET 的原生 Delphi TTable 和 TQuery 组件。除了 SQL 支持外,直接表访问使 Advantage 在许多其他 Delphi 产品中独一无二。Advantage 支持大型表(仅受记录数限制,20 亿)并具有免费的本地引擎,这对于开发 PC 和不需要客户端/服务器功能的小型客户站点来说非常有用。使用单个连接属性切换到客户端/服务器,没有其他更改。

We have a ton of clients so accessing the data outside of Delphi is also very easy (.NET data provider, ODBC, OLE DB, PHP, Perl, JDBC, etc).

我们有大量的客户端,因此在 Delphi 之外访问数据也很容易(.NET 数据提供程序、ODBC、OLE DB、PHP、Perl、JDBC 等)。

Main Product Web Site: http://www.advantagedatabase.comDeveloper's Web Site: http://devzone.advantagedatabase.com

主要产品网站:http: //www.advantagedatabase.com开发者网站:http: //devzone.advantagedatabase.com

回答by Javier

As for size, nothing beats SQLite.

至于大小,没有什么比 SQLite 更好的了。

when you refer about lack of documentation, i guess it's doc for DISQLite3. The SQLite docsare quite complete

当您提到缺乏文档时,我想它是 DISQLite3 的文档。在SQLite的文档是相当完整