Version: 1.2

db: Database connectivity

Ryan Culpepper <>

A database interface for functional programmers.

 (require (planet ryanc/db:1:2))

This package provides a high-level interface to several database systems. The following database systems are currently supported:
  • PostgreSQL versions 7.4 and later

  • MySQL versions 5 and later

  • SQLite version 3 requires native library

  • ODBC requires ODBC installation

Support for PostgreSQL and MySQL does not rely on any native client libraries; this package is everything you need to connect to a PostgreSQL or MySQL server. Support for SQLite and ODBC requires the appropriate native libraries to be installed.

The query operations are functional in spirit: queries return results or raise exceptions rather than stashing their state into a cursor object for later navigation and retrieval. Query parameters and result fields are automatically translated to and from appropriate Racket values. Resources are managed automatically by the garbage collector and via custodians. Connections are internally synchronized, so multiple threads can use a connection simultaneously.

Acknowledgments Thanks to Dave Gurnell, Noel Welsh, Mike Burns, and Doug Orleans for contributions to spgsql, the PostgreSQL-only predecessor of this package. The SQLite support is based in part on code from Jay McCarthy’s sqlite package.

Development Development of this library is hosted by GitHub at the following project page:

Copying This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License and GNU Lesser General Public License for more details.