hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sathi Chowdhury <sathi.chowdh...@lithium.com>
Subject FW: hive server2 jdbc
Date Tue, 11 Nov 2014 01:08:18 GMT


Hello hive users ,
I am trying to use hive2 jdbc connection for the first time .

publicclass MyHiveJDBCClient {

privatestatic String driverName = "org.apache.hive.jdbc.HiveDriver";

    private static final Logger LOG = LoggerFactory.getLogger(MyHiveJDBCClient.class);


publicstatic void main(String[] args) throws SQLException {

try {

Class.forName(driverName);

} catch (Exception e) {

e.printStackTrace();

System.exit(1);

}

Connection con = DriverManager.getConnection(

"jdbc:hive2://xyz.ab.com:10000/prod", "", "");

Statement stmt = con.createStatement();

    String sql = "show tables";

    System.out.println("Running: " + sql);

    ResultSet res = stmt.executeQuery(sql);

    while (res.next()) {

      System.out.println(res.getString(1));

    }

}

Seems to be successfully executing the query but acts on only default db and shows tables
from default db.
Why is it not connecting to prod db,any clue?
Thanks
Sathi

Mime
View raw message