Lightweight SQL Database Which Doesn't Require Installation

Lightweight SQL database which doesn't require installation

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.

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.

In short each has its pluses and minuses. Again, take my rant with a pinch of salt, its just my personal experience.

Do lightweight and no-install database systems exist?

You can try SQLite. It does not need a separate server instance yet you can write SQL queries.

C# Sql-server on every client

The best thing for your purpose is to use database servers, which will be started with your application, like SQLite or Sql Server Compact. That means, you application host the database it self and you have access over ADO.Net. This is a very smart kind of storing local data and very easy.

Do not try to install complex database systems like mssql, sybase or mysql on every client.

For example, SQLite can be delivered with a few assemblies in your product.

This answers gives a nice overview: Lightweight SQL database which doesn't require installation

Database on a server without installation?

If you are going to store data on a network share and have concurrent users accessing it you are going to need a db that can handle concurrent access. MS Access will quickly die if under concurrent access as will SQL Lite.

SQL Server Express is free and works very well. PostgreSQL as suggested by Maxim is an open source full featured db that will do the job very well but may be overkill.

You could also look at Redis ... fast lightweight in memory no sql db that also has capability to persist to file.

WPF standalone local database without server installation

SQLite does support Multi-Threading (SQLite And Multiple Threads) and it doesn't require installation so it meets all your requirements...

SQLite support three different threading modes:

Single-thread. In this mode, all mutexes are disabled and SQLite is
unsafe to use in more than a single thread at once.

Multi-thread. In this mode, SQLite can be safely used by multiple
threads provided that no single database connection is used
simultaneously in two or more threads.

Serialized. In serialized mode, SQLite can be safely used by multiple
threads with no restriction.

The threading mode can be selected at compile-time (when the SQLite
library is being compiled from source code) or at start-time (when the
application that intends to use SQLite is initializing) or at run-time
(when a new SQLite database connection is being created). Generally
speaking, run-time overrides start-time and start-time overrides
compile-time. Except, single-thread mode cannot be overridden once
selected.

The default mode is serialized.

Lightweight database (SQL or NoSQL)

if you need the lightest-weight database i would say sqlite 3. it's purpose designed for this task, is small and fast, and in my experience is reliable and easy to use.

i don't use php myself, but there appears to be support here.

sqlite supports pretty much "standard" sql, except that it doesn't enforce types - you can define a column to be text, but store and retrieve an integer value, if you feel like it. in practice, it's not a big deal and as long as you don't use this "feature" you can switch to a larger database in the future with little trouble.

but, in practice, i would start with mysql since it is likely already installed and available. if it gives you issues with memory use, switch to sqlite. but for a simple, no frills database, you might as well start with mysql.

Light Sql Database

Some options:

  1. Sqllite: No install - just dll. Very light, powerful and proven (they claim to be the most installed database in the world).
  2. Sql Compact: No install - just a dll, doesn't support all of the sql syntax like sql express or sql server.
  3. SQL Express: Lighter than SQL server and is SQL syntax compatible.
  4. SQL LocalDB: Still has an installer but doesn't need a windows service running. sqlserver.exe starts on demand. Supports the SQL syntax of SQL server and express.

This may also help out:
http://blogs.msdn.com/b/jerrynixon/archive/2012/02/26/sql-express-v-localdb-v-sql-compact-edition.aspx

If this is a desktop light app - then I would recommend sqlite or sqlcompact and possibly localdb if you need more complete t-sql capabilities. The simplicity of just needing to copy a binary to access the DB in-proc is great for a client app. Be aware that LocalDB/SQLExpress still has an installer and SQLExpress adds windows services to the clients box which might be overkill and add complexity.

What is a good choice of database for a small .NET application?

14/06/2016 Yep... still getting upvotes :-/


17/03/2014 I'm still receiving upvotes for this, be mindful of the date this was originally answered. Though the main three items listed are still entirely viable, the list will tend towards becoming stale. There are further database technologies available that are not listed.


You have a couple of immediately recognisable and free options:

  • SQL Server Express LocalDB
  • SQL Server Compact Edition
  • SQLite

The SQL Server Compact download comes with the ADO.NET provider that you will need to reference in code. The SQLite download might not have it so here is a link:

http://sqlite.phxsoftware.com/

All three use SQL, though likely with a few limitations / quirks. Management Studio works with Compact and LocalDB, whereas with SQLite you will need another UI tool such as SQLite Administrator:

http://sqliteadmin.orbmu2k.de/

There are NoSQL alternatives, such as:

  • Sterling
  • RavenDb

Personally I would avoid using MS Access in the face of other free options. You cannot go wrong with LocalDB, Compact, or SQLite. They are all lovely small databases that run relatively quickly in little RAM - personal preference as to the religious aspects about liking a Microsoft product I suppose :-)

I use Sterling for Windows Phone programming as it is built to use Isolated Storage. I have only seen articles on RavenDb, but I can tell you that it is a JSON based document storage framework.

Not to confuse the situation (go with SQLite, SQL Server Express LocalDB, or SQL Server Compact Edition), but there are other embedded / local databases out there, some are relational others are object-oriented:

  • Embedded Firebird
  • db4o
  • VistaDb
  • SharpHSQL
  • Berkeley DB
  • Eloquera
  • SiaqoDb

Not all of these are free. SQL / LINQ / in-proc support differs across them all. This list is just for curiosity.

There is now also Karvonite, however the code gallery link is broken. When it's live again I'll be looking into this one for WP7 development.

Lightest Database to be packed with an application

JavaDB (Sun's supported distribution of the open source Apache Derby), HSQLDB (not very active) and H2 (the successor of HSQLDB) are all 100% Java embeddable database engines and can all be used with Hibernate (i.e. there are dialect for them). Refer to this page and this one.

HSQLDB has the smallest footprint (~700 KB) of all of them. But feature wise (see this comparison), H2 is the clear winner and its footprint (~1 MB) is still smaller than Derby's one (~2 MB).

The final choice depends on what you need but H2 is a good compromise of features and size (in other words, a big competitor). Have a look at the mentioned comparison.



Related Topics



Leave a reply



Submit