Skip to content

Instantly share code, notes, and snippets.

@pjullah
Last active September 6, 2017 14:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pjullah/8eee26981c078e5e8ed02492653179f1 to your computer and use it in GitHub Desktop.
Save pjullah/8eee26981c078e5e8ed02492653179f1 to your computer and use it in GitHub Desktop.
Working with MySQL in boot
(boot.core/merge-env! :dependencies '[[org.clojure/java.jdbc "x.y.z"][mysql/mysql-connector-java "x.y.z"]])
(require '[clojure.java.jdbc :as sql])
(def db-host "127.0.0.1")
(def db-port 3306)
(def db-name "cmdb")
(def db-user "root")
(def db-password "my-secret-pw")
(def db-spec {
:classname "com.mysql.jdbc.Driver"
:subprotocol "mysql"
:subname (str "//" db-host ":" db-port "/" db-name)
:user db-user
:password db-password})
(sql/query db-spec ["SELECT * FROM table"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment