Connect impala with odbc and php pdo, string fields are empty -


when use odbc only, run successfully

$dsn = "dsn=dingdongimpala;host=172.168.1.100;port=21050;database=mmdb;"; $user = ''; $password = ''; $conn = odbc_connect($dsn, $user, $password); $result = odbc_exec($conn, "select succount,failedcount,appid t_mm_acc_date limit 1"); while($row = odbc_fetch_array($result)) {     print_r($row); } 

the result is:

array (     [succount] => 0          //int     [failedcount] => 1       //int     [appid] => 202361        //string ) 

but when use pdo access odbc, string type fields empty

$dsn = "odbc:dsn=dingdongimpala;host=172.168.1.100;port=21050;database=mmdb;"; $user = ''; $password = ''; $cnx = new pdo($dsn, $user, $password); $result = $cnx->query("select succount,failedcount,appid t_mm_acc_date limit 1"); print_r($result->fetchobject()); 

the result is:

stdclass object (     [succount] => 100       //int     [failedcount] => 0      //int     [appid] =>              //string, empty ) 

i tried lot of cases, long select string field impala, result empty, int fields normal.
system environment:

centos 6 php 5.3.6 php-odbc-5.3.3 unixodbc-2.2.14 clouderaimpalaodbc-2.5.29.1009-1.el6.x86_64.rpm 

i'm facing same issue, workaround i'm casting string fields varchar, this:

select succount, failedcount, cast(appid varchar(255)) t_mm_acc_date limit 1 

Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -