MAPREDUCE服务 MRS-Impala开发规则:执行Impala SQL

时间:2024-06-29 14:11:32

执行Impala SQL

执行Impala SQL,注意Impala SQL不能以";"结尾。

正确示例:

String sql = "SELECT COUNT(*) FROM employees_info";
Connection connection = DriverManager.getConnection(url, "", "");
PreparedStatement statement = connection.prepareStatement(sql);
resultSet = statement.executeQuery();

错误示例:

String sql = "SELECT COUNT(*) FROM employees_info;";
Connection connection = DriverManager.getConnection(url, "", "");
PreparedStatement statement = connection.prepareStatement(sql);
resultSet = statement.executeQuery();
support.huaweicloud.com/devg3-mrs/mrs_07_330022.html