ldbc: Pure functional JDBC layer with Cats Effect 3 and Scala 3.

A project named LDBC was created and became an affiliate project of Typelevel.

LDBC is a database library written in Scala3.
It was just released last month and is rough around the edges, but you can touch it!

This is what makes me happy when I use LDBC.

  • Type safety: compile-time guarantees, development-time complements, read-time information
  • Declarative: Separates the form of the table definition (“What”) from the database connection (“How”).
  • SchemaSPY Integration: Generate documents from table descriptions
  • Models can be generated from SQL files.
  • Libraries, not frameworks: can be integrated into your stack

Please read the README documentation for more information!


Looks great! Typelevel is really missing out on some quickstart ORM-like libs.

I tried to write something slightly similar some time ago and ended up with skunk-tables, which I don’t have time to maintain right now.

I think LDBC can borrow at least the syntax for default tables - in skunk-tables you don’t have to always describe the precise DB types and constraints, but it infers the some sensible ones.


The method of building with only the necessary constraints is a very good idea.

I will read the skunk-tables code and refer to it!

1 Like

LDBC now supports Scala.js and Scala Native, not just JVM!

To connect to a MySQL database in Scala, you need to use JDBC, which is a standard Java API that can also be used in Scala.
Since JDBC is implemented in Java, it can only be used in the JVM environment when used in Scala.

Therefore, connecting to MySQL using JDBC is not available in Scala.js and Scala Native.
LDBC has developed a new connector that connects to the MySQL server in pure Scala3 so that it can work with Scala.js, Scala Native.

This is still an experimental feature and an alpha release, but it is available in the following versions.

The LDBC connector is the lowest layer API.
We plan to use this connector to provide higher-layer APIs in the future. We also plan to make it compatible with existing higher-layer APIs.

LDBC used the Skunk project as a reference in creating its own MySQL connector.
We would like to thank the team for creating this wonderful project called Skunk!


Hm… could this also work with ZIO? Or its cats baked into the core od the library?

1 Like

I can’t speak authoritatively, but glancing around the code it appears to be written in good, effect-neutral style – pretty much orthodox cats-effect. So I would give decent odds that it works with ZIO if you have the right abstractions available.

1 Like

Hm… could this also work with ZIO? Or its cats baked into the core od the library?

Currently it is only available in Cats Effect.

I would like to be able to work with ZIO.
However, I have never touched ZIO myself, and there are still many things to be developed regarding the MySQL connector, so I have not yet started.

Once we have created some MySQL connector functionality, we will begin to consider support for ZIO.

First, let’s examine whether it works according to How to Interop with Cats Effect? | ZIO.


LDBC v0.3.0-alpha5 is released.

After five alpha releases, we have added support for features such as Savepoint and Batch commands!

This is still an experimental feature and an alpha release, but it is available in the following versions.

1 Like

Must mention, as an existing Skunk user, Skunk Tables looks nice, if a bit early for non-experimental use :clap:

I encourage you to keep it aligned with Skunk as it evolves towards 1.x (seems you are).

Postgres is where it’s at for me (well, perhaps CockroachDB but same difference from Skunk’s POV). MySQL I’d use when someone is paying me to.

I always had a soft spot for Hibernate ORM. Seems to have a terrible reputation, but I must have had the rare luck to work in a team that understood how to use it correctly. We didn’t spend all day fighting it…

1 Like