hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Hadoop Wiki] Trivial Update of "Hive/HiveClient" by RaghothamMurthy
Date Sun, 09 Aug 2009 07:20:37 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Hadoop Wiki" for change notification.

The following page has been changed by RaghothamMurthy:
http://wiki.apache.org/hadoop/Hive/HiveClient

------------------------------------------------------------------------------
  
  = JDBC =
  For embedded mode, uri is just "jdbc:hive://". For standalone server, uri is "jdbc:hive://host:port/dbname"
where host and port are determined by where the hive server is run. For example, "jdbc:hive://localhost:10000/default".
Currently, the only dbname supported is "default".
- 
+ == JDBC Client Sample Code ==
  {{{
  import java.sql.SQLException;
  import java.sql.Connection;
@@ -77, +77 @@

      }   
    }
  }
- 
+ }}}
+ == Running the JDBC Sample Code ==
+ {{{
  # Then on the command-line
  $ javac HiveJdbcClient.java
  
@@ -164, +166 @@

  
  = PHP =
  Operates only on a standalone server. 
+ {{{
+ <?php
+ // set THRIFT_ROOT to php directory of the hive distribution
+ $GLOBALS['THRIFT_ROOT'] = '/lib/php/';
+ // load the required files for connecting to Hive
+ 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';
+ // Set up the transport/protocol/client
+ $transport = new TSocket('localhost', 10000);
+ $protocol = new TBinaryProtocol($transport);
+ $client = new ThriftHiveClient($protocol);
+ $transport->open();
+ 
+ // run queries, metadata calls etc
+ $client->execute('SELECT * from src');
+ var_dump($client->fetchAll());
+ $transport->close();
+ }}}
  
  = Thrift Java Client =
  Operates both in embedded mode and on standalone server. 
+ 
  = ODBC =
- Operates only on a standalone server. In the works.
+ Operates only on a standalone server. See [wiki:Self:Hive/HiveODBC HiveODBC].
  
  = Thrift C++ Client =
  Operates only on a standalone server. In the works.

Mime
View raw message