Peter Marklund

Peter Marklund's Home


Clojure on Heroku Gotcha - PostgreSQL, Luminus, and JDBC

As I rewrote this blog in Clojure using Luminus one of the main stumbling blocks was getting the PostgreSQL connection working on Heroku. It turned out that the Java DriverManager that the library talks to can't handle the Heroku DATABASE_URL directly as it contains username and password. However, if you pass the db specification as a string to then the clojure function will parse the database URL for you and pass on the proper credentials on Java. This turns out to be well described in the Heroku documentation (see below) it's just that :connection-uri that the Luminus uses by default (as of this writing) doesn't work on Heroku.