Question

I'm making this tiny utility program (Windows Forms) and it would need to save a bit of data to the disk. In DB terms it would be about one table, no more than about couple thousand rows, each row being less then 1KB in size.

What would you use?

Added: Forgot to say - it would be really neat if the whole program would be just one .EXE file (plus the data file, of course). Thus I'd prefer something that is built in .NET.

Was it helpful?

Solution

SQLite.It is small and have great wrapper for .Net.

OTHER TIPS

Or theres Esent, the built in database that exists in every copy of windows. Read about it here: http://ayende.com/Blog/archive/2008/12/23/hidden-windows-gems-extensible-storage-engine.aspx

If you're feeling brave, I've put together a simple document db PieDb (as in 'easy as').

You could use SQL Server Compact Edition (provided with Visual Studio), or SQLite.

There are many others, but these are the most common.

I'm a big fan of SQLite, because it's tiny, simple and fast. There is an awesome ADO.NET provider for it, which supports the Entity Framework.

If you are talking a single table, I can't quite see why you feel you HAVE to use a relational database to achieve your goals. What about a single file?

Naturally, depending on the reason you need to store information, and the way the data is related, there can be a reason for you to need a db. But you ought to consider if a DB is actually what you need in this case.

A relational database shouldn't BE the defacto standard for storing data. There are many many alternatives you should consider before selecting the RDBMS.

See mcintyre321's post for instance.

If you're set on using an embedded DB, then SQL Server Compact Edition is probably your best bet followed by SQLite as a close second.

If you're talking one table, it sounds like an embedded DB might be overkill and you could be better served by a simple text file.

You can create an array of your class, mark it [Serializable] and just use the built-in serialize/deserialize methods for persistence.

I second the vote for SQLite. SQL Server CE is far too heavy for any embedded purposes unless you need easy synchronization with a central database - then it's fantastic.

the .NET port of SQLite is at http://code.google.com/p/csharp-sqlite/. It's pure .NET so you could ILMerge into a single .exe

For something that small and simple I would probably go with XML and not use a database. If you abstract the CRUD code you can later modify the data tier portion of the code so that it uses a database when the data grows in size and complexity.

Once I investigated same problem. From all possible candidates two looked good. These are SQLite and Firebird (firebirdsql.org). But the firebird had some more features than SQLite.

UPD: Here an interesting info about firebird+dotnet http://www.firebirdsql.org/dotnetfirebird/embedded/index.html

Berkeley DB is also a good choice for embedded database. And there is a library that provides a .NET 2.0 interface for it.

If it doesn't have to be a SQL-compatible database, then I'd also look at Db4o. Db4o is an object database for Java and .NET. The .NET version is completely written in C#.

I second SQL Lite or a simple XML file with deflate writer to minimize size. Quick and no so dirty.

Try this one: https://github.com/mdsoftware/mData. No 3rd parties, all sources included, some nice stuff like Lisp-like data processing and expression compiler also included. I have tried to make something really simple but functional.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top