hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hashut...@apache.org
Subject svn commit: r1304068 - /hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveConnection.java
Date Thu, 22 Mar 2012 21:13:23 GMT
Author: hashutosh
Date: Thu Mar 22 21:13:22 2012
New Revision: 1304068

URL: http://svn.apache.org/viewvc?rev=1304068&view=rev
Log:
HIVE-2577: Expose the HiveConf in HiveConnection API (Nicolas Lalevee via Ashutosh Chauhan)

Modified:
    hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveConnection.java

Modified: hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveConnection.java
URL: http://svn.apache.org/viewvc/hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveConnection.java?rev=1304068&r1=1304067&r2=1304068&view=diff
==============================================================================
--- hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveConnection.java (original)
+++ hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveConnection.java Thu Mar 22 21:13:22
2012
@@ -18,6 +18,7 @@
 
 package org.apache.hadoop.hive.jdbc;
 
+import org.apache.hadoop.hive.conf.HiveConf;
 import org.apache.hadoop.hive.metastore.api.MetaException;
 import org.apache.hadoop.hive.service.HiveClient;
 import org.apache.hadoop.hive.service.HiveInterface;
@@ -60,6 +61,23 @@ public class HiveConnection implements j
   private static final String URI_PREFIX = "jdbc:hive://";
 
   /**
+   * Create a connection to a local Hive
+   *
+   * @param hiveConf
+   * @throws SQLException
+   */
+  public HiveConnection(HiveConf hiveConf) throws SQLException {
+    try {
+      client = new HiveServer.HiveServerHandler(hiveConf);
+    } catch (MetaException e) {
+      throw new SQLException("Error accessing Hive metastore: "
+          + e.getMessage(), "08S01",e);
+    }
+    isClosed = false;
+    configureConnection();
+  }
+
+  /**
    * TODO: - parse uri (use java.net.URI?).
    */
   public HiveConnection(String uri, Properties info) throws SQLException {



Mime
View raw message