Java 版本
openjdk 18.0.2-ea 2022-07-19
OpenJDK Runtime Environment (build 18.0.2-ea+9-Ubuntu-222.04)
OpenJDK 64-Bit Server VM (build 18.0.2-ea+9-Ubuntu-222.04, mixed mode, sharing)
但是当我在我文本编辑器中启动 nREPL 时,它说
Starting nREPL server...
/usr/lib/jvm/java-11-openjdk-amd64/bin/java ...
依赖关系
:dependencies [[org.clojure/clojure "1.11.1"]
[com.github.seancorfield/next.jdbc "1.3.834"]
[org.postgresql/postgresql "42.5.0"]
[com.layerware/hugsql "0.5.3"]]
代码
(def db
{:classname "org.postgresql.Driver"
:subprotocol "postgresql"
:subname "reporting"
:user "admin"
:password "admin"})
(defn add-user-transaction [users]
(jdbc/with-transaction [t-conn db]
(if-not (find-user t-conn {:id (:id users)})
(add-user! t-conn users))))
在此配置下,一切照常工作,但是只有在
(add-user-transaction {:id "cheryl"
:pass "Cheryl"})
评估时出错误。
它在这Clojure: Execution error (SQLException) at java.sql.DriverManager/getConnection (DriverManager.java:702) 中已被询问并已经回答了,但那里的唯一答案是使用 :deps
或 deps.edn
(据我所知,这是 Maven 仓库),那么 Leiningen 怎么样?或者我错过了有关 Leiningen 和 Maven 的某些内容?
甚至重启了电脑、文本编辑器和 nREPL,但没有任何变化。