我想从clojure.
java.jdbc创建/删除数据库.这失败了:
(require '[clojure.java.jdbc :as sql]) (def db {:classname "org.postgresql.Driver" :subprotocol "postgresql" :subname "//localhost/postgres" :user "postgres"}) (defn drop-database [name] (sql/do-commands (str "drop database " name))) (sql/with-connection db (drop-database "db_name"))
因为do-commands启动一个事务,显然你不能在事务中删除或创建数据库.有任何想法吗?
谢谢!