public class JdbcAip {
public static void main(String[] args) throws SQLException, ClassNotFoundException {
Connection connection = getConnection();
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("写sql语句");
while (resultSet.next()){
String string = resultSet.getString(1);
String string1 = resultSet.getString(2);
int anInt = resultSet.getInt(3);
System.out.println(string+" "+string1+" "+anInt);
}
}
private static Connection getConnection() throws ClassNotFoundException, SQLException {
Class.forName("org.apache.hive.jdbc.HiveDriver");
Connection connection = DriverManager.getConnection("jdbc:hive2://192.168.72.134:10000", "root", "123456");
return connection;
}
}
Hive-JavaApi
最新推荐文章于 2022-06-22 09:15:08 发布