title: jdbc to hive connection refused
body: <p>I am trying to connect to hive via jdbc. Below is the code i am using:</p>
  
  <pre><code>import java.sql.DriverManager;
  import java.sql.ResultSet;
  import java.sql.SQLException;
  import java.sql.Statement;
  import java.sql.Connection;
  
  public class HiveToJava {
      private static String driverName = "org.apache.hadoop.hive.jdbc.HiveDriver";
  
      /**
       * @param args
       * @throws SQLException
       */
      public static void main(String[] args) throws SQLException {
          try {
              Class.forName(driverName);
          } catch (ClassNotFoundException e) {
  
              e.printStackTrace();
              System.exit(1);
          }
          Connection con = DriverManager.getConnection(
                  "jdbc:hive://localhost:10000/default", "", "");
          Statement stmt = con.createStatement();
          String tableName = "processed";
          ResultSet res = stmt.executeQuery("describe " + tableName);
          while (res.next()) {
              System.out.println(res.getString(1) + "\t" + res.getString(2));
          }
  
      }
  }
  </code></pre>
  
  <p>When I run this class as a Java application, I get this msg :</p>
  
  <blockquote>
    <p>Exception in thread "main" java.sql.SQLException: Could not establish
    connection to localhost:10000/default: java.net.ConnectException:
    Connection refused</p>
  </blockquote>
  
  <p>Please help.</p>