I'm using the Impala ODBC driver provided by Cloudera. I can't seem to use query parameters correctly. For instance:
OdbcCommand command = DbConnection.CreateCommand();
command.CommandText = "INSERT INTO TABLE test VALUES(?, ?)";
command.Parameters.Add("key", OdbcType.VarChar).Value = "csharp";
command.Parameters.Add("val", OdbcType.VarChar).Value = "test";
command.ExecuteNonQuery();
throws the following exception.
{"ERROR [HY000] [Cloudera][ImpalaODBC] (110) Error while executing a query in Impala: [HY000] : AnalysisException: Syntax error in line 1:\nINSERT INTO TABLE test VALUES(?, ?)\n
^\nEncountered: Unexpected character\nExpected: CASE, CAST, EXISTS, FALSE, IF, INTERVAL, NOT, NULL, TRUNCATE, TRUE, IDENTIFIER\n\nCAUSED BY: Exception: Syntax error\n"}
Which should manage query parameters (and replacement of ? by values), ODBC library or the driver ? It seems to be the driver and in this case, it's not implemented... And it's a shame because I cannot use prepared statement.
Does somebody know a way to use query parameters with the Impala ODBC driver?
"command.CommandText = "INSERT INTO TABLE test VALUES(?, ?)";
is correct butcommand.CommandText = "INSERT INTO TABLE test VALUES(?, ?);";
would give me the same error you got. This isn't your problem, but thought it might help others. – Patrick Szalapski