Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defn do-with-connection [f]
- (let [con (.getConnection DriverManager "jdbc:mysql://localhost/paulbarry?user=root")]
- (let [r (f con)]
- (.close con)
- r)))
- (defn select-first [sql]
- (do-with-connection
- (fn [con]
- (let [rs (.executeQuery (.createStatement con) sql)]
- (.next rs)
- (.getString rs 1)))))
Add Comment
Please, Sign In to add comment