H2 Database port  ·  embeddable SQL engine for .NET

H2, now on .NET

H2Sharp brings the legendary Java H2 engine to C#. A usable subset runs end to end: an ADO.NET provider over an in-memory engine — DDL, DML, SELECT with GROUP BY, UNION, predicates, ordering and aggregates, parameters — measured against the reference H2 on the JVM. JOIN, subqueries and window functions are not ported yet, and a class that parses a statement but cannot execute it refuses loudly instead of answering wrongly.

H2 2.5.252 + pin 27c5170 ADO.NET spec 293/293 ✓ 947 SQL conformance tests · 251 pass EF Core 1034 ✓ · linq2db provider in-memory engine MVStore file-compat ✓
-- H2 mirror @27c5170, original: h2database.com
SELECT id, COUNT(*) FROM test
  GROUP BY id HAVING COUNT(*) > 2
  ORDER BY 1 NULLS LAST;
MERGE INTO test KEY(id) VALUES(2, 'World');
EXPLAIN SELECT * FROM test WHERE id = 1;
// phase 8 gate: Dapper smoke over IDbConnection
await using var con = new H2Connection(cs);
await con.OpenAsync();
await con.ExecuteAsync("CREATE TABLE test(id INT PRIMARY KEY, name VARCHAR)");
await con.ExecuteAsync("INSERT INTO test VALUES(1,'Hi')");
var rows = await con.QueryAsync<Test>("SELECT * FROM test");

Quickstart

A real query today, through Dapper over IDbConnection:

using H2Sharp.Data;

using IDbConnection con = new H2Connection("jdbc:h2:mem:demo");
con.Open();
con.Execute("CREATE TABLE PERSON(ID INT PRIMARY KEY, NAME VARCHAR)");
con.Execute("INSERT INTO PERSON VALUES(@Id, @Name)", new { Id = 1, Name = "Ada" });

var rows = con.Query<Person>("SELECT * FROM PERSON");

Build and test the port:

dotnet build H2Sharp.sln
dotnet test

NuGet — the package builds and is signed; publishing comes later:

# the package exists and packs; it is not on nuget.org yet
dotnet add package H2Sharp --prerelease

SQL reference, pinned to the ported version

The original lives on h2database.com and moves on. We keep a snapshot at commit 27c5170 (H2 2.5.x, October 2026) in our own design — with a link to the original and H2 Group attribution.

Read this first: this section mirrors H2's full grammar, which is the reference the port is written against. The engine executes a subset today — no JOIN, subqueries, window functions or MERGE yet. What actually runs is listed on the status page.
Snapshot: H2 2.5.252 (2026-09-23) + H2Sharp pin 27c5170 (2026-10-06) · Original: h2database.com · upstream commit · Pin delta — a DROP ALL OBJECTS fix for local temp tables; grammar matches.

Commands mirror

SELECT, INSERT, UPDATE, DELETE, MERGE, DDL — the full command syntax.

Open →

Functions mirror

Scalar, aggregate, and window functions with examples.

Open →

Data Types mirror

Types, domains, literals, CAST, and formats.

Open →

Grammar mirror

The full expression and predicate grammar.

Open →

System Tables mirror

INFORMATION_SCHEMA and system views.

Open →

How it updates pipeline

Crawler + provenance.json: date, URLs, content SHAs.

About the pipeline →

.NET API

The ADO.NET layer works and is gated by an inherited conformance suite plus a green Dapper flow. The ORM layers come after it. No invented signatures — every section reflects what is in the repository.

System.Data available

H2Connection, H2Command, H2Parameter, H2DataReader, H2Transaction, H2DataAdapter, H2ProviderFactory. Transactions work.

Reference →

Dapper works today

End-to-end over IDbConnection: open, create, insert, update, select, delete, transactions.

Examples →

Native API planned

Direct engine access. The engine executes real queries now; a public surface is not promised yet.

Stub →

EF Core in progress

Its own repository: a fork of EFCore.PG with H2's surface. 1034 inherited EF Core tests pass, none red.

Details →

linq2db in progress

Its own repository, written from scratch against linq2db's public API. Query, insert, filter and order work.

Details →

Port status

Phases 0–10: what is done / in progress / todo — from the code.

Open →

Where we are

Read from the repositories themselves, since docs/ROADMAP.md still lags the code. Honestly: the engine executes real queries, the built-in function layer is ported, the catalogue is ported, the ADO.NET provider is 293/293 on its conformance suite — and two provider projects are already running alongside it. Constraints, JOIN and the rest of the grammar are the open work.

0–2 · Bootstrap, Foundationdone — CI, oracle, MVStore file-compat
3 · Values, schemadone for what is portable
4 · Expressionspartial — built-ins ported, window functions not
5 · Commands/SQLpartial — SELECT, UNION, DML, DDL, PK constraints
6 · Enginepartial
8 · ADO.NETdone — 293/293 spec, transactions
9 · EF Corein progress — 1034 EF Core tests green
linq2dbin progress — own repository
7, 10todo — constraints, conformance polish