Created
December 13, 2011 15:12
-
-
Save bnyeggen/1472470 to your computer and use it in GitHub Desktop.
Clojure to Hive via JDBC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(comment Add [org.clojure/java.jdbc "0.1.1"] to project dependencies) | |
(ns myproject.core | |
(:use [clojure.java.jdbc :only [with-connection, with-query-results]])) | |
(let [db-host "MyHost" | |
db-port 10000 | |
db-name "default"] | |
(def db {:classname "org.apache.hadoop.hive.jdbc.HiveDriver" ; must be in classpath | |
:subname (str "//" db-host ":" db-port "/" db-name) | |
:subprotocol "hive"})) | |
(with-connection db | |
(with-query-results rs ["select * from people"] | |
(dorun (map #(println (:name %)) rs)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks a lot.
For HiveServer2: