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.

Hive_PHP | How to connect HiveServer2 with PHP, using Thrift ?

Highlighted

Hive_PHP | How to connect HiveServer2 with PHP, using Thrift ?

New Contributor

Hi,

I have 4 node HDPcluster . In that second node I installed Hiveserver2 and apache lamp server.

I want to connect HiveServer2 to PHP. Is there any way to connect. I tried but unable to resolve the issue.

Could anybody suggest any idea or blog.

Thanks.

2 REPLIES 2

Re: Hive_PHP | How to connect HiveServer2 with PHP, using Thrift ?

@Surendra Shringi

You can use ODBC to connect to hiveserver2 with php. You can download and install the odbc client and then use the dbc connect for php: http://php.net/manual/es/function.odbc-connect.php

Re: Hive_PHP | How to connect HiveServer2 with PHP, using Thrift ?

New Contributor

Hi thanks for quick reply @Felix Albani

I tried but i didn't find out any way to connect. I am getting below error.

Opened transport
Fatal error: Uncaught exception 'Thrift\Exception\TApplicationException' with message 'Invalid method name: 'OpenSession'' in /var/www/html/hs2/hive/org/apache/hive/service/cli/thrift/TCLIService.php:89 Stack trace: #0 /var/www/html/hs2/hive/org/apache/hive/service/cli/thrift/TCLIService.php(56): org\apache\hive\service\cli\thrift\TCLIServiceClient->recv_OpenSession() #1 /var/www/html/hs2/HS2Client.php(40): org\apache\hive\service\cli\thrift\TCLIServiceClient->OpenSession(Object(org\apache\hive\service\cli\thrift\TOpenSessionReq)) #2 {main} thrown in /var/www/html/hs2/hive/org/apache/hive/service/cli/thrift/TCLIService.php on line 89

Could you pls let me know any solution.