Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

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

Highlighted

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

New Contributor

Hi,

 

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)

 

 
Don't have an account?
Coming from Hortonworks? Activate your account here