无需安装的轻量级 SQL 数据库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/271319/
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
Lightweight SQL database which doesn't require installation
提问by Alexander Prokofyev
Could you recommend a lightweight SQL database which doesn't require installation on a client computer to work and could be accessed easily from .NET application? Only basic SQL capabilities are needed.
您能否推荐一个轻量级 SQL 数据库,它不需要在客户端计算机上安装即可工作,并且可以从 .NET 应用程序轻松访问?只需要基本的 SQL 功能。
Now I am using Access database in simple projects and distribute .MDB and .EXE files together. Looking for any alternatives.
现在我在简单的项目中使用 Access 数据库并将 .MDB 和 .EXE 文件一起分发。寻找任何替代品。
采纳答案by nawfal
Depends on what you mean by lightweight. Easy on Ram? Or lighter db file? Or lighter connector to connect to db? Or fewer files over all? I'll give a comparison of what I know:
取决于你所说的轻量级是什么意思。拉姆容易吗?或者更轻的数据库文件?或者更轻的连接器连接到数据库?还是更少的文件?我将比较我所知道的:
no of files cumulative size of files db size
Firebird 2.5 5 6.82 MB 250 KB
SqlServerCe 4 7 2.08 MB 64 KB
Sqlite 3.7.11.0 1 0.83 MB 15 KB
VistaDb 4.3.3.34 1 1.04 MB 48 KB
no of files - includes the .net connector and excludes the db file
The dbs are of 1 table with 2 columns and 2 rows. Take the db size with a pinch of salt as dbs could grow differently with further use. For instance SqlServerCe
though initially was at 64 KB, it didn't grow at all after adding a few hundred records, while VistaDb
grew easily from 48 to 72 to 140 KB. SQLite was the best in that regard which started from the lowest and grew linearly.
dbs 是 1 个表,有 2 列和 2 行。用少量的盐来获取 db 大小,因为 dbs 可能会随着进一步使用而不同地增长。例如,SqlServerCe
虽然最初是 64 KB,但在添加几百条记录后它根本没有增长,而VistaDb
从 48 到 72 到 140 KB 很容易增长。SQLite 在这方面是最好的,它从最低的开始并线性增长。
Few anecdotes: I had better performance using SqlServerCe with the factory settings which means its the easiest to get kick started without any configuration, while I found Firebird little bit harder to get it started due to lack of online materials. Firebird as I could read had widest standard sql compliance. While VistaDb is written in fully managed C# which means it can be merged with your application's assembly to have one single file, it seemed slowest to me. Of all, considering performance, ease and size I chose SQLite. SqlServerCe would be my second choice.
一些轶事:我在出厂设置下使用 SqlServerCe 有更好的性能,这意味着它最容易上手而无需任何配置,而我发现 Firebird 由于缺乏在线资料而难以上手。我能读到的 Firebird 具有最广泛的标准 sql 合规性。虽然 VistaDb 是用完全托管的 C# 编写的,这意味着它可以与应用程序的程序集合并为一个文件,但对我来说它似乎是最慢的。最重要的是,考虑到性能、易用性和大小,我选择了 SQLite。SqlServerCe 将是我的第二选择。
In short each has its pluses and minuses. Again, take my rant with a pinch of salt, its just my personal experience.
简而言之,每个都有其优点和缺点。再一次,用一小撮盐接受我的咆哮,这只是我的个人经历。
回答by CMS
回答by Jason Short
You could look at VistaDB if you are writing in .NET. It is 100% managed code, contains true referential integrity, tsql stored procs, clr procs, and much more in a single assembly you can xcopy deploy.
如果您使用 .NET 编写,您可以查看 VistaDB。它是 100% 托管代码,包含真正的参照完整性、tsql 存储过程、clr 过程以及您可以 xcopy 部署的单个程序集中的更多内容。
VistaDB runs in shared hosting asp.net sites under medium trust, and in active directory domains as guest (no local permissions) as well.
VistaDB 在中等信任度的共享托管 asp.net 站点中运行,并且在活动目录域中作为来宾(无本地权限)运行。
There are no registry or other configuration settings required on the machine you deploy the engine on, and the runtime is royalty free.
在您部署引擎的机器上不需要注册表或其他配置设置,并且运行时是免版税的。
32/64 bit support is included in the single assembly. Mixed mode engines with unmanaged code generally require you to ship more than 1 version of the unmanaged code to support 32 and 64 bit, or to recompile for specific CPU targets.
32/64 位支持包含在单个程序集中。具有非托管代码的混合模式引擎通常需要您提供 1 个以上版本的非托管代码以支持 32 位和 64 位,或者为特定 CPU 目标重新编译。
See the Advantages of VistaDBSO thread for more information.
回答by stephbu
Howabout SQL Server 3.5/2008 Compact Edition? A neat embedded version of SQL Server.
SQL Server 3.5/2008精简版怎么样?SQL Server 的简洁嵌入式版本。
http://www.microsoft.com/Sqlserver/2008/en/us/compact.aspx
http://www.microsoft.com/Sqlserver/2008/en/us/compact.aspx
Works pretty nice with .NET, and of course all your regular SQL Server tools and scripts work fine.
与 .NET 配合使用非常好,当然所有常规 SQL Server 工具和脚本都可以正常工作。