Which binding should i use for sqlite , for mariadb & for postgresql

Which binding should i use for sqlite , for mariadb & for postgresql ?

1 Like

At LexiFi we have used GitHub - mmottl/postgresql-ocaml: OCaml-bindings for the PostgreSQL database for PostgreSQL and GitHub - mmottl/sqlite3-ocaml: OCaml bindings to the SQLite3 database for SQLite for a long time and found them solid.

Cheers,
Nicolas

1 Like

If you are looking for a unified API, there is Caqti. It uses the lower level bindings mentioned by @nojb (and also supports MariaDB using mariadb-ocaml. It feels like the “jdbc for OCaml” but with much more!

It provides three high-level API, either a standard blocking interface, or asynchronous with Lwt or asynchronous with Janestreet’s Async).

3 Likes

Caqti is nice and can be completed nicely with ppx_rapper which transforms a commented SQL string into a typed wrapper.

See GitHub - roddyyaga/ppx_rapper: Syntax extension for writing SQL in OCaml

4 Likes