SqlDatabase.Net a free .NET embedded sql database

Install-Package SQLDatabase.Net
Install-Package SQLDatabase.Net.PCL.dll
Strong-Named:      Install-Package SQLDatabase.Net.dll

Cross Platform

Same database file format for desktop and mobile. Database files are copy paste deployment!

Pure .Net

Only require .NET framework, mono or Xamarin no third party dependencies no dll issues.

In-Memory Database

A complete in memory database, Sql Database can use System.IO.MemoryStream.

Single Code Base

No need to write different codes share same across desktop, mobile and server NetStandard 2.0

SQLDatabase.Net Introduction

The most recent stable version is 2.7.0.0 with support for multithreading, parallel for and multiple active results sets with optional extended result sets with rich information about query. Starting with version 2.6 changes can also be tracked.

SQLDatabase.Net is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. It is single threaded and works with existing process. It is developed in .net, mono and xamarin. It is one of the fastest-growing database engines around, it supports both on disk and in-memory database engines with ability to provide external memory stream for further control on your data, same format for Android, iOS and ASP.NET. It's free to use in any kind of project, including commerical use projects.

The engine is not a standalone process however you can link it statically or dynamically as per your requirement. The non PCL library accesses its storage files directly, you simply reference it in your project and copy it along your program for deployment, the portable class library accesses stream and memory stream and allow application to have complete control on file.

It's reliable, fast and free and can be redistributed with your program or can even be merged using ILMerge utility. It was written in .Net 2.0 but with current version 1.0.0.0 require minimum .Net 3.5 Client Profile and Portable Class Library verion require .Net 4.5. Starting version 2.0.0.0 minimum .NET 4.0 Client Profile is required. Database file format is same between all versions, upgrade does not require any changes to data or database file.

SqlDatabase Compatibility

  • Windows
  • Windows Server
  • Linux (mono)
  • Mac (mono)
  • ASP.Net
  • DotNet Core 2.0

Portable Class Library for Xamarin targets

  • .NET Framework 4.5
  • ASP.NET Core 1.0
  • Windows 8 and Windows Phone 8.1
  • Xamarin.Android
  • Xamarin.iOS and iOS(Classsic)
  • Xamarin.Mac

Get Started

using SQLDatabase.Net.SQLDatabaseClient;
using (SqlDatabaseConnection cnn = new SqlDatabaseConnection()) 
{
	cnn.ConnectionString = "SchemaName=db;uri=file://C:\\Folder\\dbFile.db";
	cnn.Open();

if (cnn.State == ConnectionState.Open)
	{
		using (SqlDatabaseCommand cmd = new SqlDatabaseCommand())
{ cmd.Connection = cnn; cmd.CommandText = "SELECT * FROM Table"; cmd.ExecuteReader(); } } }


Portable Class Library

Portable class library has minor few limitations, e.g. there is no encryption in verion 1.0.0.0 and requires stream or memory stream provided by the application.

						
using SQLDatabase.Net.PCL.SQLDatabaseClient;

using (SqlDatabaseConnection cnn = new SqlDatabaseConnection()) 
{
	cnn.Stream = new FileStream(FILENAME , FileMode.OpenOrCreate);
	cnn.CloseStreamsOnDispose = true; //optional
	cnn.ConnectionString = "SchemaName=db;uri=file://FILENAME;";
	cnn.Open();

if (cnn.State == ConnectionState.Open)
	{
		using (SqlDatabaseCommand cmd = new SqlDatabaseCommand())
		{
			cmd.Connection = cnn;
			cmd.CommandText = "SELECT * FROM Table";
			cmd.ExecuteReader();
		}
	}
}