16

Ideally something that will work with Oracle, MS SQL Server, MySQL and Posgress.

3 Answers 3

11

if you mean common lisp by lisp, then there's cl-rdbms. it is heavily tested on postgres (uses postmodern as the backend lib), it has a toy sqlite backend and it also has an OCI based oracle backend. it supports abstracting away the different sql dialects, has an sql quasi-quote syntax extension installable on e.g. the [] characters.

i'm not sure if it's the best, and i'm biased anyway... :) but we ended up rolling our own lib after using clsql for a while, which is i think the most widely used sql lib for cl.

see cliki page about sql for a further reference.

8

At the moment there's no open-source library that supports all the SQL backends you mention. CLSQL comes quite close (lacking only support for MS SQL). The alternatives are:

  • CL-RDBMS (which supports Oracle, Postgres through Postmodern and SQLite3)
  • Postmodern (only Postgres).

If you can use a commercial Lisp, you can give a try to CommonSQL included with Lispworks, which supports all the databases you mentioned.

CLSQL looks like the most popular open source library at the moment. Unfortunately, it seems to suffer from bit rot, and the developers had to make some compromises to support all those platforms.

If the RDB backend is not a constraint, then I recommend Postmodern. It is very well documented and has a clean API (and a nice small language compiled to SQL). Also, it is well maintained and small enough to keep being understandable and extensible. It focuses only on Postgres, not trying to be all things for all people.

5
  • it's wrong. see cliki.net/SQL Sep 23, 2008 at 19:54
  • I guess you were right. But if CLSQL supported MS SQL I would be right :-) Anyway, I edited my answer. Sep 23, 2008 at 20:14
  • Isn't MS SQL reachable by ODBC? CL-SQL is supposed to support ODBC. Sep 24, 2008 at 12:24
  • They don't say anything about MS SQL in CLSQL's documentation. Sep 24, 2008 at 23:40
  • CLSQL definitely communicates with MSSQL over ODBC just fine (better than plain-ODBC in my limited experience) Jun 4, 2015 at 12:46
2

Allegro Common Lisp has an ODBC library and a MySQL-specific library, both exhaustively documented. I've used the MySQL one; no surprises.

Not the answer you're looking for? Browse other questions tagged or ask your own question.