本文介绍了如何使用clojure在JDBC中禁用自动提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用Clojure的JDBC接口来更新Hive数据库。特别是,我想添加分区。代码如下:
I want to use Clojure's JDBC interface to update an Hive database. In particular, I want to add partitions. The code would be like the following:
(jdbc/db-do-commands hive-db ["ALTER TABLE foo ADD PARTITION (year=2015, month=10, day=1, hour=1) LOCATION '/bar'"])
$ b b
但是,我收到一个错误:
However, I'm getting an error:
java.sql.SQLException: enabling autocommit is not supported
at org.apache.hive.jdbc.HiveConnection.setAutoCommit (HiveConnection.java:1071)
clojure.java.jdbc$db_transaction_STAR_.doInvoke (jdbc.clj:605)
clojure.lang.RestFn.invoke (RestFn.java:425)
...
,在Hive的JDBC驱动程序中启用自动提交功能后,未解决。因此,我想禁用自动提交。如何在 clojure.java.jdbc
?
As I'm aware, enabling autocommit in Hive's JDBC driver has several unresolved issues presently. Thus I want to disable autocommit. How is this done in clojure.java.jdbc
?
推荐答案
类似以下的东西将是有帮助的:
Perhaps something like the following would be of assistance:
(let [con (db-find-connection db)]
(.setAutoCommit con false))
运气最好。
这篇关于如何使用clojure在JDBC中禁用自动提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!