H2Sharp 0.1.43-alpha.1

This is a prerelease version of H2Sharp.
dotnet add package H2Sharp --version 0.1.43-alpha.1
                    
NuGet\Install-Package H2Sharp -Version 0.1.43-alpha.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="H2Sharp" Version="0.1.43-alpha.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="H2Sharp" Version="0.1.43-alpha.1" />
                    
Directory.Packages.props
<PackageReference Include="H2Sharp" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add H2Sharp --version 0.1.43-alpha.1
                    
#r "nuget: H2Sharp, 0.1.43-alpha.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package H2Sharp@0.1.43-alpha.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=H2Sharp&version=0.1.43-alpha.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=H2Sharp&version=0.1.43-alpha.1&prerelease
                    
Install as a Cake Tool

H2Sharp — H2 Database ported to C#

CI .NET 8 / 10 H2 reference 2.5.x License: MPL-2.0 OR EPL-1.0

H2Sharp

H2Sharp is an embeddable SQL database engine for .NET — a faithful port of H2 Database 2.5.x from Java to C#. It exposes a standard ADO.NET provider (System.Data.Common), so ordinary DbConnection/DbCommand code, Dapper and other provider-agnostic consumers run against an in-process engine: no server, no separate process. Both in-memory and file-based MVStore databases are supported, and files written here open in the reference Java H2 2.5.259 — and vice versa.

Open connections through H2DataSource. It owns the database and is the only correct way to connect: every connection it hands out shares one engine instance. A directly constructed H2Connection is a self-contained, single-connection database and does not share state.

Where the reference H2 can do something the port cannot yet, the port throws TODOException rather than returning a plausible but wrong answer: a stub that refuses is never a stub that answers.

Quick start

using System;
using H2Sharp.Data;

// H2DataSource owns the database. Always connect through it.
using H2DataSource source = new H2DataSourceBuilder("Data Source=quickstart;Storage=Memory").Build();
using H2Connection connection = (H2Connection)source.CreateConnection();
connection.Open();

using var create = connection.CreateCommand();
create.CommandText = "CREATE TABLE T(ID INT, NAME VARCHAR(20))";
create.ExecuteNonQuery();

using var insert = connection.CreateCommand();
insert.CommandText = "INSERT INTO T VALUES ($id, $name)";
var id = insert.CreateParameter();
id.ParameterName = "$id";
id.Value = 1;
insert.Parameters.Add(id);
var name = insert.CreateParameter();
name.ParameterName = "$name";
name.Value = "bolt";
insert.Parameters.Add(name);
insert.ExecuteNonQuery();

using var query = connection.CreateCommand();
query.CommandText = "SELECT NAME FROM T WHERE ID = $id";
var key = query.CreateParameter();
key.ParameterName = "$id";
key.Value = 1;
query.Parameters.Add(key);
Console.WriteLine(query.ExecuteScalar()); // bolt

For a persistent database, change Storage=Memory to Storage=File. The resulting MVStore file is readable by the reference Java H2 2.5.259 and vice versa.

What is in the package

  • H2Sharp.Data — H2DataSource, H2DataSourceBuilder, H2Connection, H2Command, H2Parameter, H2DataReader, H2ProviderFactory, H2Batch and the ADO.NET provider.
  • In-memory and file-based storage; MVStore files round-trip with Java H2 2.5.259.
  • Named parameters ($name), arrays, JSON, regular expressions with .NET syntax, window functions, INFORMATION_SCHEMA and MVStore transactions.
  • Targets net8.0 and net10.0.

Optional packages are published separately: H2Sharp.Crypto, H2Sharp.Extensions, H2Sharp.CsvTools, H2Sharp.Hashes, H2Sharp.JavaLegacy.

Documentation and source

Licensing

H2 is dual-licensed under the Mozilla Public License 2.0 and the Eclipse Public License 1.0. H2Sharp is a derivative work and is offered under the same terms.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on H2Sharp:

Package Downloads
H2Sharp.CsvTools

Optional CSVREAD and CSVWRITE functions for H2Sharp, backed by CsvHelper.

H2Sharp.Crypto

Optional ENCRYPT and DECRYPT functions for H2Sharp.

H2Sharp.JavaLegacy

Optional Java-compatibility helpers for H2Sharp.

H2Sharp.Hashes

Optional SHA-224 and SHA3-224 providers for H2Sharp.

H2Sharp.Extensions

Optional user-defined aggregates and examples for H2Sharp.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.43-alpha.1 0 11/23/2026
0.1.42-alpha.1 0 11/23/2026
0.1.41-alpha.1 0 11/23/2026