【发布时间】:2016-06-02 17:02:55
【问题描述】:
clojure 新手。尝试连接oracle数据库报错
SQLException ORA-28040: No matching authentication protocol
oracle.jdbc.driver.DatabaseError.throwSqlException (DatabaseError.java:112)
我怀疑依赖项有问题,但我太新了,无法弄清楚
这是我的 project.clj 文件
(defproject my_project "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.6.0"]
[org.clojure/java.jdbc "0.6.1"]
[com.oracle.jdbc/com.springsource.oracle.jdbc "10.2.0.2"]
[com.oracle.xdb/com.springsource.oracle.xdb "10.2.0.2"]])
这是代码。我正在尝试在 REPL 中执行 f2 函数 那就是我收到错误的时候
;; defines the parameters for connecting to the database
(def db-info {:hostname "dont.want.to.tell.com"
:port 1521
:database "db"
:user "someuser"
:password "somepassword"})
;; creates connection string from the db-info map
(defn get-connection-string [db-info]
(str "thin:@" (:hostname db-info) ":" (:port db-info) ":" (:database db-info)))
;;defines the db map that would be used for queries
(def db {:classname "oracle.jdbc.OracleDriver"
:subprotocol "oracle"
:subname (get-connection-string db-info)
:user (:user db-info)
:password (:password db-info)})
(defn f2 []
(jdbc/query db ["select * from secret_table where rownum < 2"] {:row-fn :cost}))
【问题讨论】:
-
您使用的是哪个 Oracle 驱动程序版本?看看关于 SO 的类似问题,例如stackoverflow.com/a/26604277/597473