Connect Hive through PHP XAMPP

Alles, was PHP betrifft, kann hier besprochen werden.

Connect Hive through PHP XAMPP

Postby snehal8 » 16. December 2013 10:54

I have created one UI using Bootstrap in that UI i wanted to connect HIVE to take the existing tables and display in drop down.

My Question is it possible to connect HIVE through PHP and if yes than how to do this.

Thanks & Regards
Snehal
snehal8
 
Posts: 2
Joined: 16. December 2013 10:30
Operating System: Linux

Re: Connect Hive through PHP XAMPP

Postby snehal8 » 16. December 2013 11:49

Hello Everyone


I got my solution using php-thrift-hive-client

download from https://github.com/garamon/php-thrift-hive-client

Here is code:

Code: Select all
<?php
$GLOBALS['THRIFT_ROOT'] = dirname(__FILE__) . '/lib';
require_once $GLOBALS['THRIFT_ROOT'] . '/packages/hive_service/ThriftHive.php';
require_once $GLOBALS['THRIFT_ROOT'] . '/transport/TSocket.php';
require_once $GLOBALS['THRIFT_ROOT'] . '/protocol/TBinaryProtocol.php';

require_once dirname(__FILE__) . '/ThriftHiveClientEx.php';

$transport = new TSocket('localhost', 10000);
$transport->setSendTimeout(600 * 1000);
$transport->setRecvTimeout(600 * 1000);
$client = new ThriftHiveClientEx(new TBinaryProtocol($transport));
$client->open();
$client->execute('SHOW DATABASES');
var_dump($client->fetchAll());
$client->close();
?>



Thank you :) :)
snehal8
 
Posts: 2
Joined: 16. December 2013 10:30
Operating System: Linux


Return to PHP

Who is online

Users browsing this forum: No registered users and 2 guests