Support Questions
Find answers, ask questions, and share your expertise
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

error when connecting to hive via jdbc


error when connecting to hive via jdbc

New Contributor


I am new in Hortonworks HDP Sandbox, I am trying to connect to sandbox Hive via the jdbc driver, this is my code:

private static String driverName = "org.apache.hadoop.hive.jdbc.HiveDriver";   
 public static void main(String[] args) throws SQLException {
        try {
        } catch (ClassNotFoundException e) {
        Connection con = DriverManager.getConnection(

I am using the hive url given by ambari, however, I got this error:

Exception in thread "main" java.sql.SQLException: Invalid URL: jdbc:hive2://;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2
    at org.apache.hadoop.hive.jdbc.HiveConnection.<init>(
    at org.apache.hadoop.hive.jdbc.HiveDriver.connect(
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at Hive2.main(

please if anyone know how to solve this issue let me know, I have trying since long time