Support Questions
Find answers, ask questions, and share your expertise

IMPALA ODBC via PHP PDO = "Error while executing a query in Impala"

New Contributor



Ive got PHP7x and impala/kudu (provided by cloudera). Ive got the ODBC connection which connects fine and if you run raw sql non-parameterised queries it works fine as well.

However, I cant bind parameters:



$c_connect_pdo = new \PDO('odbc:cloudera_dsn_connection', '', '');
$c_connect_pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);

try {
    $statement = $c_connect_pdo->prepare("INSERT INTO test1 VALUES(:id, :val)");
    $statement->bindValue(':id', $id, \PDO::PARAM_INT);
    $statement->bindValue(':val', $val, \PDO::PARAM_STR);
    $res = $statement->execute();

} catch (PDOException $e) {
    echo $e->getMessage();



This is the error I get:


SQLSTATE[HY000]: General error: 110 [Cloudera][ImpalaODBC] (110) Error while executing a query in Impala: [HY000] : ParseException: Syntax error in line 1: INSERT INTO test1 VALUES(?, ?) ^ Encountered: Unexpected character Expected: CASE, CAST, DEFAULT, EXISTS, FALSE, IF, INTERVAL, LEFT, NOT, NULL, REPLACE, RIGHT, TRUNCATE, TRUE, IDENTIFIER CAUSED BY: Exception: Syntax error (SQLExecute[110] at ext\pdo_odbc\odbc_stmt.c:260)