Hive | Server Address Java

// No username/password required with auth=noSasl try (Connection conn = DriverManager.getConnection(jdbcUrl, "", ""); Statement stmt = conn.createStatement()) String sql = "SHOW TABLES"; ResultSet rs = stmt.executeQuery(sql); while (rs.next()) System.out.println(rs.getString(1));

import java.sql.*; public class HiveJdbcClient public static void main(String[] args) throws Exception // Hive server address (HS2) String jdbcUrl = "jdbc:hive2://192.168.1.100:10000/default;auth=noSasl"; hive server address java

a) No SASL (plain, insecure – test only) jdbc:hive2://host:10000/default;auth=noSasl Use empty user/pass. b) Kerberos (production, secure) jdbc:hive2://host:10000/default;principal=hive/_HOST@REALM.COM Java side: ResultSet rs = stmt.executeQuery(sql)

implementation 'org.apache.hive:hive-jdbc:3.1.3' hive-jdbc pulls Hadoop & Hive dependencies – make sure versions match your server. 4. Full Java Connection Example (No Authentication) For development clusters without Kerberos/LDAP: while (rs.next()) System.out.println(rs.getString(1))