Browse Clojure Foundations for Java Developers

Interacting with Databases Using JDBC

Treat SQL and connections as an edge: parameterize queries and return plain data.

JDBC interop is a great example of “pure core, impure shell” design:

  • the DB layer is effectful (connections, transactions, retries)
  • the rest of your program can stay pure (transforming query results into domain data)

For Java engineers, the key is to keep database work localized:

  • parameterized queries (no string concatenation)
  • explicit transaction boundaries
  • result sets converted into plain maps/vectors early

This section focuses on patterns that keep persistence code small and easy to test.

In this section

Revised on Friday, April 24, 2026