<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: How to connect PHP with HIVE through THRIFT in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-connect-PHP-with-HIVE-through-THRIFT/m-p/185488#M83273</link>
    <description>&lt;A rel="user" href="https://community.cloudera.com/users/91299/hariprasanthmadhavan.html" nodeid="91299"&gt;@Hariprasanth Madhavan&lt;/A&gt;&lt;P&gt; Please mark the answer, if you see it correct &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 18 Sep 2018 12:28:47 GMT</pubDate>
    <dc:creator>cravani</dc:creator>
    <dc:date>2018-09-18T12:28:47Z</dc:date>
    <item>
      <title>How to connect PHP with HIVE through THRIFT</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-connect-PHP-with-HIVE-through-THRIFT/m-p/185484#M83269</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;    I have 4 node HDPcluster .in that second node I installed Hiveserver2 and apache lamp server. &lt;/P&gt;&lt;P&gt;   What are all the configurations should I  give for thrift PHP and Hive. I want to know the prerequisites for thrift with hive and steps to connect hive and php   &lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2018 13:39:16 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-connect-PHP-with-HIVE-through-THRIFT/m-p/185484#M83269</guid>
      <dc:creator>hariprasanthmad</dc:creator>
      <dc:date>2018-09-07T13:39:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to connect PHP with HIVE through THRIFT</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-connect-PHP-with-HIVE-through-THRIFT/m-p/185485#M83270</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/91299/hariprasanthmadhavan.html" nodeid="91299"&gt;@Hariprasanth Madhavan&lt;/A&gt; You can connect via ODBC to Query HiveServer2.&lt;/P&gt;&lt;P&gt;ODBC Driver can be downloaded from: &lt;A href="https://hortonworks.com/downloads/" target="_blank"&gt;https://hortonworks.com/downloads/&lt;/A&gt; -&amp;gt; HDP Addons&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2018 17:36:50 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-connect-PHP-with-HIVE-through-THRIFT/m-p/185485#M83270</guid>
      <dc:creator>cravani</dc:creator>
      <dc:date>2018-09-07T17:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to connect PHP with HIVE through THRIFT</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-connect-PHP-with-HIVE-through-THRIFT/m-p/185486#M83271</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/15788/cravani.html" nodeid="15788"&gt;@Chiran Ravani&lt;/A&gt;&lt;P&gt; Thank you,&lt;/P&gt;&lt;P&gt;Can you refer me a &lt;STRONG&gt;configuration and package&lt;/STRONG&gt; details for ODBC Connectivity? give me an Example &lt;STRONG&gt;Code for the hive and PHP ODBC&lt;/STRONG&gt; connectivity. &lt;/P&gt;&lt;P&gt;I referred this link also &lt;A href="https://cwiki.apache.org/confluence/display/Hive/HiveODBC" target="_blank"&gt;https://cwiki.apache.org/confluence/display/Hive/HiveODBC&lt;/A&gt; but, I can't able to connect with Hive Properly.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Sep 2018 19:05:04 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-connect-PHP-with-HIVE-through-THRIFT/m-p/185486#M83271</guid>
      <dc:creator>hariprasanthmad</dc:creator>
      <dc:date>2018-09-10T19:05:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to connect PHP with HIVE through THRIFT</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-connect-PHP-with-HIVE-through-THRIFT/m-p/185487#M83272</link>
      <description>&lt;P&gt;Here is the sample code which may help you.&lt;/P&gt;&lt;PRE&gt;&amp;lt;html&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;?php
      $conn=odbc_connect('TestODBC','hive','');
 if (!$conn){
    exit("Connection to the database Failed: " . $conn);
 }
 $sql="show databases";
 $resultSet=odbc_exec($conn, $sql);
 if (!$resultSet){
    exit("Error!");}
           echo "&amp;lt;table&amp;gt;&amp;lt;tr&amp;gt;";
    echo "&amp;lt;th&amp;gt;Database Name&amp;lt;/th&amp;gt;";
    while (odbc_fetch_row($resultSet))
      {
  $dbName=odbc_result($resultSet,"database_name");
  echo "&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;$dbName&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;";
    }
    odbc_close($conn);
    echo "&amp;lt;/table&amp;gt;";
    ?&amp;gt;
 &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;Note: I do not have any authentication metod set for Hive, so I have used AuthMEth=2 in my odbc.ini file as below.&lt;/P&gt;&lt;PRE&gt;[TestODBC]
Description=Hortonworks Hive
Driver=/usr/lib/hive/lib/native/Linux-amd64-64/libhortonworkshiveodbc64.so
Host=HiveServer2Hotname
PORT=10000
schema=default
HiveServerType=2
AuthMech=2
ThriftTransport=0
&lt;/PRE&gt;&lt;P&gt;Below is Sample Output&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="92473-screen-shot-2018-09-18-at-25450-am.png" style="width: 700px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/18879i8562557873BD5C12/image-size/medium?v=v2&amp;amp;px=400" role="button" title="92473-screen-shot-2018-09-18-at-25450-am.png" alt="92473-screen-shot-2018-09-18-at-25450-am.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 08:21:17 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-connect-PHP-with-HIVE-through-THRIFT/m-p/185487#M83272</guid>
      <dc:creator>cravani</dc:creator>
      <dc:date>2019-08-18T08:21:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to connect PHP with HIVE through THRIFT</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-connect-PHP-with-HIVE-through-THRIFT/m-p/185488#M83273</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/91299/hariprasanthmadhavan.html" nodeid="91299"&gt;@Hariprasanth Madhavan&lt;/A&gt;&lt;P&gt; Please mark the answer, if you see it correct &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 12:28:47 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-connect-PHP-with-HIVE-through-THRIFT/m-p/185488#M83273</guid>
      <dc:creator>cravani</dc:creator>
      <dc:date>2018-09-18T12:28:47Z</dc:date>
    </item>
  </channel>
</rss>

