简体   繁体   English

使用clojure时jdbc执行错误

[英]jdbc execute error when using clojure

The following link https://my.vertica.com/docs/6.0.x/HTML/index.htm#14874.htm mentioned we could use 以下链接https://my.vertica.com/docs/6.0.x/HTML/index.htm#14874.htm提到了我们可以使用的

boolean result = stmt.execute("COPY customers FROM "
                            + " '/data/customers.txt' DIRECT ENFORCELENGTH");

But it doesn't work in clojure 但这在Clojure中不起作用

(clojure.java.jdbc/execute! vertica-db "copy customer1.stage_test_etl_195 from '/tmp/valid-197.csv' DELIMITER '|' DIRECT ENFORCELENGTH ")

ClassCastException java.lang.Character cannot be cast to java.lang.String  clojure.java.jdbc/prepare-statement (jdbc.clj:457)

Have a careful read of the clojure.jdbc documentation. 请仔细阅读clojure.jdbc文档。 The second argument to execute! 第二个参数执行! should be a vector with the first element being the SQL and other (optional) parameters. 应该是一个向量,第一个元素是SQL和其他(可选)参数。 The following may work 以下可能工作

(clojure.java.jdbc/execute! vertica-db ["copy customer1.stage_test_etl_195 from '/tmp/valid-197.csv' DELIMITER '|' DIRECT ENFORCELENGTH "])

assuming that is a legal statement for the db backend 假设这是数据库后端的法律声明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM