Work with Relational Databases

By virtue of running on the Java Virtual Machine, Clojure works with any database that can be accessed via Java Database Connectivity (JDBC).[63] With it, we can easily access a large number of RDBMS databases, such as MySQL, SQL Server, PostgreSQL, and Oracle. The core library for dealing with relational databases is clojure.java.jdbc. When using this library we have to write custom SQL for each type of database we intend to use.

Most Clojure database libraries are based on clojure.java.jdbc. One such library that we’ll cover in this chapter is called HugSQL.[64] This library takes the approach of keeping the SQL separate from the Clojure source files.

Another popular library is called Honey SQL.[65] This ...

Get Web Development with Clojure, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.