Created
January 8, 2013 14:36
-
-
Save bouzuya/4484208 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| (require '[clojure.java.jdbc :as sql]) | |
| (def db | |
| "postgresql://postgres:postgres@localhost:5432/shouter") | |
| (sql/with-connection db | |
| (try (sql/drop-table :testing) (catch Exception _))) | |
| (sql/with-connection db | |
| (sql/create-table :testing [:data :text])) | |
| (sql/with-connection db | |
| (sql/insert-rows | |
| :testing | |
| ["Hello, world!"] | |
| ["Hello, PostgreSQL!"])) | |
| (sql/with-connection db | |
| (sql/with-query-results results | |
| ["select * from testing"] | |
| (into [] results))) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Apache Derby 版は https://gist.github.com/4484275
project.cljの[postgresql "9.1-901.jdbc4"]も忘れずに。