clojureをmysqlに接続しようとしていますが、どういうわけか失敗します。私のproject.cljは次のとおりです。
(defproject my-project "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.3.0"]
[org.clojure/java.jdbc "0.2.3"]]
:jvm-opts ["-Djdbc.drivers=com.mysql.jdbc.Driver"])
私のファイルは:
(ns my-project
(:require [clojure.java.jdbc :as sql]))
(def db {:classname "com.mysql.jdbc.Driver"
:subprotocol "mysql"
:subname "//localhost:3306/db"
:user "xxx"
:password "xxx"})
そして、私はREPLから以下を実行しようとしています:
(sql/with-connection db (sql/with-query-results rows "show tables;"))
私が得ているエラーは次のとおりです。
No suitable driver found for jdbc:mysql://localhost:3306/db
私はSQLにdbというデータベースを持っており、mysql.serverがポート3306で実行されていることを確認しました。誰かが私にヒントをくれたらありがたいです。また、私のエラーメッセージは、指定したユーザー名とパスワードに依存せず、mysqlのログファイルには何も表示されません。
ありがとう!