38

I was (and still am) looking for an embedded database to be used in a .net (c#) application. The caveat: The Application (or at least the database) is stored on a Network drive, but only used by 1 user at a time.

Now, my first idea was SQL Server Compact edition. That is really nicely integreated, but it can not run off a network.

Firebird seems to have the same issue, but the .net Integration seems to be not really first-class and is largely undocumented.

Blackfish SQL looks interesting, but there is no trial of the .net Version. Pricing is also OK.

Any other suggestions of something that works well with .net and runs off a network without the need of actually installing a server software?

Csa77
  • 649
  • 13
  • 19
Michael Stum
  • 177,530
  • 117
  • 400
  • 535
  • Interesting that this post is not considered to be "opinion based" in contrast to my post http://stackoverflow.com/questions/20229964/multi-user-application-without-need-to-install-anything-embedded-database-that. Anyway - i think all of the proposed embedded databases works for one user on server (including SQL CE), some of them allow concurrent reads (like SQLite), but only one (at least the only one I have found and tested that it WORKS!) that allows concurrent writes is VistaDB – Prokurors Dec 15 '13 at 12:53

11 Answers11

25

SQLite came to my mind while reading your question, and I'm quite sure that it's possible to access it from a network drive if you keep yourself to the constraint of 1 user at a time.

SQLite on .NET - Get up and running in 3 minutes

sven
  • 18,198
  • 10
  • 51
  • 62
  • I've tested it during the past weeks, and SQLite is really a great product. It is not a full flavorued RDBMS of course, but it has all the features needed to get the job done. – Michael Stum Oct 18 '08 at 15:05
  • @Sven: SQLite actually has rather comprehensive file locking, and a SQLite database can definitely be accessed by multiple users at a single time. On filesystems that support it, SQLite will even use byte-range instead of whole-file locking to improve the performance of multiple simultaneous uses of the same database. It's not Access; it's pretty robust. – Chris Hanson Aug 10 '08 at 09:08
  • @ChrisHanson It allows only read access for multiple users at the same time – Prokurors Dec 15 '13 at 12:46
10

I'd recommend Advantage Database Server (www.advantagedatabase.com). It's a mature embedded DB with great support and accessible from many development languages in addition to .NET. The "local" version is free, runs within your application in the form of a DLL, requires no installation on the server/network share, and supports all major DB features. You can store the DB and/or application files all on the network; it doesn't care where the data is.

Disclaimer: I am an engineer in the ADS R&D group. I promise, it rocks :)

Peter Funk
  • 695
  • 4
  • 5
9

You can use the firebird embeded, it's just a dll that you will need to ship with you app.

About things being undocumented, that's not really true, the firebird .NET driver implements the ADO Interfaces, so if you know ADO you can work with Firebird, basically instead of SQLConnection you will use FBConnection and so on, but my advice is to write a data access layer and use just interfaces on your code, something like this:

using FirebirdSql.Data.FirebirdClient;

public static IDbConnection MyConnection()
{
    FbConnection cn = new FbConnection("...");
    return cn;
}

This example is very simple, but you will not need much more than that.

We use firebird for our all application without any problems, you should at least try it out.

Fabio Gomes
  • 5,914
  • 11
  • 61
  • 77
9

It sounds like ADO/Access is perfect for your needs. It's baked into the MS stack, well seasoned, and multi-user.

You can programatically create a DB like so:

Dim catalog as New ADOX.Catalog
Catalog.Create("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\server\path\to\db.mdb")

You can then use standard ADO.NET methods to interact with the database.

Justin Walgran
  • 879
  • 2
  • 8
  • 14
7

Check out VistaDB. They have a very good product, the server version (3.4) is in Beta and is very close to release.

Yaakov Ellis
  • 40,752
  • 27
  • 129
  • 174
7

A little late to the post here.. And VistaDB is already mentioned, but I wanted to point out that VistaDB is 100% managed (since your post was tagged .net). It can run from a shared network drive, and is 1MB xcopy deployed.

Since you mention SQL CE, we also support T-SQL Syntax and datatypes (in fact more than SQL CE) and have updateable views, TSQL Procs and other things missing in SQL CE.

Yaakov Ellis
  • 40,752
  • 27
  • 129
  • 174
Jason Short
  • 5,205
  • 1
  • 28
  • 45
  • One more good thing about Vista (comparing to others) is that it supports concurrent writes for database file that is located on a network location - for me it was decision making feature – Prokurors Dec 15 '13 at 12:55
5

Why not use SQL Server 2005 Express edition?

It really depends on what you mean by "embedded" - but you can redistribute SQLServer2005E with your applications and the user never has to know it's there.

Embedding SQL Server Express in Applications

Embedding SQL Server Express into Custom Applications

  • @CodingTheWheel: Because it needs installation on a server, and the user will notice a service running in the background, latest when the alarm bells of every network security tool go off. Embedded means that it's part of the application or a separate .dll, but that it does not require any installation, does not try to do stuff in the registry, and does not leave any files behind when you delete it, except for the database. SQL Server Express is not embedded, Microsoft is using "embedding" as "Packaging with your application but still being a separate thing with dependencies". There are many u – Michael Stum Aug 03 '08 at 16:06
4

I'm puzzled.

You're asking for an embeded database - where the database itself is stored on the server. that translates to storing the data file on a network share. You then say that SQL Compact Edition won't work... except that if one looks at this document:

Word Document:
Choosing Between SQL Server 2005 Compact Edition and SQL Server 2005 Express Edition

On page 8 you have a nice big green tick next to "Data file storage on a network share".

So it seems to me that your first thought was the right one.

Murph
  • 9,985
  • 2
  • 26
  • 41
  • That's funny, because SQL Server specifically tells me it won't: http://img512.imageshack.us/img512/6082/sqlceerror.jpg - maybe it's a misunderstanding, as creating seems to not be possible, while accessing could work. However, for my purposes, creating the database on Application Launch was critical. – Michael Stum Apr 22 '09 at 22:02
  • Reality trumps documentation in almost every case - question then arises as to why the docs say the "wrong" thing (or at least how the discrepancy arises). [FX:Browse, Browse] Information is fairly thin on the ground in MSDN – Murph Apr 23 '09 at 11:53
  • You _CAN_ store your database in SQL Server on a network store, but only 1 SQL Server can access it. And you are then running in attached mode which is slower than dirt. Just because you can doesn't mean you should. He was asking about each app accessing the database directly, not through a server app. – Jason Short May 16 '09 at 06:05
  • Jason, without wishing to be rude, about half of that comment is wrong because we're not talking about a multi-user server version at any point, just the compact version which is basically a .DLL (unlike Express or the other "server" versions). – Murph May 19 '09 at 13:24
2

Have you considered an OODB? From the various open sources alternatives I recommend db4o (sorry for the self promotion :)) which can run either embedded or in client/server mode.

Best

Adriano

Vagaus
  • 4,174
  • 20
  • 31
2

There's also Valentina. I cam e across this product when I was working on some Real Basic project. The RB version is very good.

Stephen Cox
  • 3,535
  • 3
  • 22
  • 16
0

This question is now ancient, and a lot has changed. For my specific purposes, LiteDB is the option of choice. It's open source and has a GitHub Repository.

Apart from that, SQLite is basically the industry standard for embedded databases. There are attempts to port the code to .NET, but the prime use case involves a native library (e.g., the sqlite Nuget package) and/or a .NET P/Invoke wrapper like Microsoft.Data.SQLite.

Michael Stum
  • 177,530
  • 117
  • 400
  • 535