Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Database binding for OCaml?

I'm trying to find a library to access a database from an OCaml program. After trying ocaml-sqlite, I'm not satisfied, since it's somewhat slow.

I've seen a MySQL module, but it doesn't seem to be maintained.

like image 805
LB40 Avatar asked Sep 23 '09 18:09

LB40


3 Answers

Have you checked the Caml Hump? It has links to plenty of database bindings.

Good, mature, bindings that I can recommend are PG'OCaml by Richard Jones and postgresql-ocaml by Markus Mottl. They are both targeted at Postgresql (which is a probably a better choice for you considering you're into Ocaml).

like image 184
Jon Smark Avatar answered Nov 13 '22 05:11

Jon Smark


ocaml-mysql works without problems here - mysql api for connect/query/fetch doesn't change that much :) It lacks prepared statements though, had to implement mysql_stmt_* wrappers myself.

like image 3
ygrek Avatar answered Nov 13 '22 05:11

ygrek


I'm quite surprised that you find the ocaml-sqlite bindings slow. sqlite is fast on its own, and I believe the sqlite bindings are very well written. You should make sure you're using the up-to-date binding from Markus Mottl's page

like image 2
zrr Avatar answered Nov 13 '22 03:11

zrr