How do I set Dynamic query parameters in Apache drill. I tried and received error message saying: java.sql.SQLFeatureNotSupportedException
:
Prepared-statement dynamic parameters are not supported.
Is it true that drill does not support such a feature, as in:
String sql = "select employee_id,first_name,last_name from dfs.'employee.json' where id = ?";
PreparedStatement preparedStatement = conn.prepareStatement(sql);
preparedStatement.setString(1, 23);
ResultSet rs = preparedStatement.executeQuery(sql);
Can any one please suggest a work around for this, if there's any
As of now, this support is not there. Drill does not support Prepared-statement dynamic parameters.If still some one wants to go ahead with such dynamic parametres for their queries, they would have to set using statements this way:
Statement statement = connection.createStatement();
String queryParam = "Computers"
String sqlQuery = "select employee_id,first_name,last_name from dfs.'employee.json' where department LIKE'" +queryParam +"'"+"and conditions<...> ";
ResultSet rs = statement.executeQuery(sqlQuery);
while(rs.next)
{
do as you need
}