Last active
September 6, 2017 14:50
-
-
Save pjullah/8eee26981c078e5e8ed02492653179f1 to your computer and use it in GitHub Desktop.
Working with MySQL in boot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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