Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- git clone git://github.com/richhickey/clojure-contrib.git
- cd clojure-contrib
- build
- -Djdbc.drivers=com.mysql.jdbc.Driver
- conn = DriverManager.getConnection
- ("jdbc:mysql://localhost:8889/db_name?user=root&password=root")
- (use 'clojure.contrib.sql) ;;' satisfy prettify
- (let [db-host "localhost"
- db-port 8889
- db-name "db_name"]
- (def db {:classname "com.mysql.jdbc.Driver"
- :subprotocol "mysql"
- :subname (str "//" db-host ":" db-port "/" db-name)
- :user "root"
- :password "root"})
- (with-connection db
- (with-query-results rs ["select * from languages"]
- (dorun (map #(println (:language :iso_code %)) rs)))))
- ; rs will be a sequence of maps,
- ; one for each record in the result set.
- ; rs will be a sequence of maps,
- ; one for each record in the result set.
Add Comment
Please, Sign In to add comment