Connecting to databases is one of the common things that developers want to do from any language. In this tutorial, we will walk you through how you can connect to SQL Server from Clojure using the clojure.java.jdbc library. Note that this tutorial can be used with databases like Oracle, Postgres, DB2 or in fact for any source you have a JDBC driver. We will be showing you all CRUD operations in this tutorial for you to get started.
library. Note that this tutorial can be used with databases like Oracle, Postgres, DB2 or in fact for any source you have a JDBC driver. We will be showing you all CRUD operations in this tutorial for you to get started.
Download Leiningen script from
chmod a+x ~/bin/lein
Execute lein, and it will download the self-install package
Install SQL Server JDBC driver by running the following command
java -jar PROGRESS_DATADIRECT_JDBC_SQLSERVER_ALL.jar
Follow through the prompts of Installer and install the driver in default path or custom path.
To add the JDBC driver to Clojure classpath, you need to add it to the Maven repository by running the following command.
Now, when you go to the maven repository, you should see the DataDirect SQL Server JDBC driver there as shown below.
lein new app <app
lein gorilla :ip
(:require [clojure.string :as str]
[clojure.java.jdbc :as j]))
ddl :pokemon [
execute! db [pokemon
multi! db :pokemon [
query db [
"SELECT * FROM pokemon"
delete! db :pokemon [
"pokemon_name = ?"
We hope this tutorial helped you to get started with using Progress DataDirect JDBC drivers with Clojure. Feel free to contact us in case of any questions or issues, we will be happy to help.
Connect any data source to any application
Discussions, tips and tricks for
DataDirect Connect drivers
Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.
Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.