使用Korma传递给jdbc/query的参数数(4)错误



我正在尝试使用Korma创建一个简单的应用程序:

(ns some-proj.core)
(use 'korma.db)
(defdb db (postgres { :host "localhost"
                      :port 5430
                      :db "mydb"
                      :user "myuser"
                      :password "mypass" 
                    }))
(use 'korma.core)
(defentity tags
  (database db))
(defn foo []
  (println (select tags)))

但是我得到错误:

PS D:dev_experimentssome-proj> lein run
WARNING: update already refers to: #'clojure.core/update in namespace: korma.core, being replaced by: #'korma.core/upda
e
WARNING: update already refers to: #'clojure.core/update in namespace: some-proj.core, being replaced by: #'korma.core/
pdate
??? 27, 2016 1:39:43 AM com.mchange.v2.log.MLog <clinit>
INFO: MLog clients using java 1.4+ standard logging.
??? 27, 2016 1:39:43 AM com.mchange.v2.c3p0.C3P0Registry banner
INFO: Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10]
??? 27, 2016 1:39:43 AM com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager
INFO: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts
-> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> f
lse, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl
DefaultConnectionTester, dataSourceName -> 1hgekg19i1jrtjrjctag1m|907f2b7, debugUnreturnedConnectionStackTraces -> fals
, description -> null, driverClass -> org.postgresql.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransac
ions -> false, identityToken -> 1hgekg19i1jrtjrjctag1m|907f2b7, idleConnectionTestPeriod -> 0, initialPoolSize -> 3, jd
cUrl -> jdbc:postgresql://localhost:5430/mydb, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 10
00, maxIdleTimeExcessConnections -> 1800, maxPoolSize -> 15, maxStatements -> 0, maxStatementsPerConnection -> 0, minPo
lSize -> 3, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> null, properties -
 {user=******, password=******}, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> fals
, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ]
clojure.lang.ArityException: Wrong number of args (4) passed to: jdbc/query
        at clojure.lang.AFn.throwArity(AFn.java:429)
        at clojure.lang.AFn.invoke(AFn.java:44)
        at korma.db$exec_sql.invokeStatic(db.clj:254)
        at korma.db$exec_sql.invoke(db.clj:250)
        at korma.db$do_query.invokeStatic(db.clj:274)
        at korma.db$do_query.invoke(db.clj:270)
        at korma.core$exec.invokeStatic(core.clj:491)
        at korma.core$exec.invoke(core.clj:470)
        at some_proj.core$foo.invokeStatic(core.clj:20)
        at some_proj.core$foo.invoke(core.clj:19)
        at clojure.lang.Var.invoke(Var.java:375)
        at user$eval5.invokeStatic(form-init7824016143892937161.clj:1)
        at user$eval5.invoke(form-init7824016143892937161.clj:1)
        at clojure.lang.Compiler.eval(Compiler.java:6927)
        at clojure.lang.Compiler.eval(Compiler.java:6917)
        at clojure.lang.Compiler.load(Compiler.java:7379)
        at clojure.lang.Compiler.loadFile(Compiler.java:7317)
        at clojure.main$load_script.invokeStatic(main.clj:275)
        at clojure.main$init_opt.invokeStatic(main.clj:277)
        at clojure.main$init_opt.invoke(main.clj:277)
        at clojure.main$initialize.invokeStatic(main.clj:308)
        at clojure.main$null_opt.invokeStatic(main.clj:342)
        at clojure.main$null_opt.invoke(main.clj:339)
        at clojure.main$main.invokeStatic(main.clj:421)
        at clojure.main$main.doInvoke(main.clj:384)
        at clojure.lang.RestFn.invoke(RestFn.java:421)
        at clojure.lang.Var.invoke(Var.java:383)
        at clojure.lang.AFn.applyToHelper(AFn.java:156)
        at clojure.lang.Var.applyTo(Var.java:700)
        at clojure.main.main(main.java:37)
Exception in thread "main" clojure.lang.ArityException: Wrong number of args (4) passed to: jdbc/query, compiling:(C:U
ersandreAppDataLocalTempform-init7824016143892937161.clj:1:108)
        at clojure.lang.Compiler.load(Compiler.java:7391)
        at clojure.lang.Compiler.loadFile(Compiler.java:7317)
        at clojure.main$load_script.invokeStatic(main.clj:275)
        at clojure.main$init_opt.invokeStatic(main.clj:277)
        at clojure.main$init_opt.invoke(main.clj:277)
        at clojure.main$initialize.invokeStatic(main.clj:308)
        at clojure.main$null_opt.invokeStatic(main.clj:342)
        at clojure.main$null_opt.invoke(main.clj:339)
        at clojure.main$main.invokeStatic(main.clj:421)
        at clojure.main$main.doInvoke(main.clj:384)
        at clojure.lang.RestFn.invoke(RestFn.java:421)
        at clojure.lang.Var.invoke(Var.java:383)
        at clojure.lang.AFn.applyToHelper(AFn.java:156)
        at clojure.lang.Var.applyTo(Var.java:700)
        at clojure.main.main(main.java:37)
Caused by: clojure.lang.ArityException: Wrong number of args (4) passed to: jdbc/query
        at clojure.lang.AFn.throwArity(AFn.java:429)
        at clojure.lang.AFn.invoke(AFn.java:44)
        at korma.db$exec_sql.invokeStatic(db.clj:254)
        at korma.db$exec_sql.invoke(db.clj:250)
        at korma.db$do_query.invokeStatic(db.clj:274)
        at korma.db$do_query.invoke(db.clj:270)
        at korma.core$exec.invokeStatic(core.clj:491)
        at korma.core$exec.invoke(core.clj:470)
        at some_proj.core$foo.invokeStatic(core.clj:20)
        at some_proj.core$foo.invoke(core.clj:19)
        at clojure.lang.Var.invoke(Var.java:375)
        at user$eval5.invokeStatic(form-init7824016143892937161.clj:1)
        at user$eval5.invoke(form-init7824016143892937161.clj:1)
        at clojure.lang.Compiler.eval(Compiler.java:6927)
        at clojure.lang.Compiler.eval(Compiler.java:6917)
        at clojure.lang.Compiler.load(Compiler.java:7379)

clojure.java。jdbc最近更改了它的API。使用lein deps:tree检查类路径中的版本是否与你使用的korma所依赖的版本相匹配。

相关内容

  • 没有找到相关文章

最新更新