<?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: Not able to connect to hiveserver2  to access hivetables with python in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Not-able-to-connect-to-hiveserver2-to-access-hivetables-with/m-p/277350#M207533</link>
    <description>&lt;P&gt;I had all the pyhive related libraries previously also . I describe all the logs and actions here.. Can somebody please help me. I have marked in bold all relevant portions of the log in starting HiveServer2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I try to start Hiveserver2 as follows and here goes the log. HiveServer2 by default is getting&amp;nbsp; started on port 10002&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sudo ./hive --service metastore . (no problem-&amp;gt;success)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[shachatt1@sharmi-dgov1 bin]$ sudo ./hiveserver2 --hiveconf hive.root.logger=INFO,console&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Logs:&lt;/P&gt;&lt;P&gt;-------&lt;/P&gt;&lt;P&gt;(/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bin/python:/usr/games:/usr/local/games:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0:/opt/apache-maven-3.6.1/bin:/opt/hadoop-2.7.3/bin:/opt/hive/bin)&lt;BR /&gt;2019-09-16 13:11:17: Starting HiveServer2&lt;BR /&gt;SLF4J: Class path contains multiple SLF4J bindings.&lt;BR /&gt;SLF4J: Found binding in [jar:file:/opt/hive/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]&lt;BR /&gt;SLF4J: Found binding in [jar:file:/opt/hadoop-2.7.3/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]&lt;BR /&gt;SLF4J: See &lt;A href="http://www.slf4j.org/codes.html#multiple_bindings" target="_blank" rel="noopener"&gt;http://www.slf4j.org/codes.html#multiple_bindings&lt;/A&gt; for an explanation.&lt;BR /&gt;SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]&lt;BR /&gt;Hive Session ID = c11defb5-d58a-4124-b1b3-a42c895665fc&lt;BR /&gt;2019-09-16T13:11:20,592 INFO [main] SessionState: Hive Session ID = c11defb5-d58a-4124-b1b3-a42c895665fc&lt;BR /&gt;2019-09-16T13:11:21,429 INFO [main] session.SessionState: Created HDFS directory: hdfs://localhost:9000/hivetemp/scratchdir/shachatt1/c11defb5-d58a-4124-b1b3-a42c895665fc&lt;BR /&gt;2019-09-16T13:11:21,493 INFO [main] session.SessionState: Created local directory: /tmp/root/c11defb5-d58a-4124-b1b3-a42c895665fc&lt;BR /&gt;2019-09-16T13:11:21,501 INFO [main] session.SessionState: Created HDFS directory: hdfs://localhost:9000/hivetemp/scratchdir/shachatt1/c11defb5-d58a-4124-b1b3-a42c895665fc/_tmp_space.db&lt;BR /&gt;2019-09-16T13:11:21,522 INFO [main] sqlstd.SQLStdHiveAccessController: Created SQLStdHiveAccessController for session context : HiveAuthzSessionContext [sessionString=c11defb5-d58a-4124-b1b3-a42c895665fc, clientType=HIVESERVER2]&lt;BR /&gt;2019-09-16T13:11:21,526 WARN [main] session.SessionState: METASTORE_FILTER_HOOK will be ignored, since hive.security.authorization.manager is set to instance of HiveAuthorizerFactory.&lt;BR /&gt;2019-09-16T13:11:21,890 INFO [main] metastore.HiveMetaStoreClient: Trying to connect to metastore with URI thrift://localhost:9083&lt;BR /&gt;2019-09-16T13:11:21,910 INFO [main] metastore.HiveMetaStoreClient: Opened a connection to metastore, current connections: 1&lt;BR /&gt;2019-09-16T13:11:21,918 INFO [main] metastore.HiveMetaStoreClient: Connected to metastore.&lt;BR /&gt;2019-09-16T13:11:21,918 INFO [main] metastore.RetryingMetaStoreClient: RetryingMetaStoreClient proxy=class org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient ugi=shachatt1 (auth:SIMPLE) retries=1 delay=1 lifetime=0&lt;BR /&gt;2019-09-16T13:11:22,238 INFO [main] service.CompositeService: Operation log root directory is created: /tmp/root/operation_logs&lt;BR /&gt;2019-09-16T13:11:22,240 INFO [main] service.CompositeService: HiveServer2: Background operation thread pool size: 100&lt;BR /&gt;2019-09-16T13:11:22,240 INFO [main] service.CompositeService: HiveServer2: Background operation thread wait queue size: 100&lt;BR /&gt;2019-09-16T13:11:22,240 INFO [main] service.CompositeService: HiveServer2: Background operation thread keepalive time: 10 seconds&lt;BR /&gt;2019-09-16T13:11:22,241 INFO [main] service.CompositeService: Connections limit are user: 0 ipaddress: 0 user-ipaddress: 0&lt;BR /&gt;2019-09-16T13:11:22,338 INFO [main] metastore.HiveMetaStoreClient: Mestastore configuration metastore.filter.hook changed from org.apache.hadoop.hive.ql.security.authorization.plugin.AuthorizationMetaStoreFilterHook to org.apache.hadoop.hive.metastore.DefaultMetaStoreFilterHookImpl&lt;BR /&gt;2019-09-16T13:11:22,343 INFO [main] metastore.HiveMetaStoreClient: Closed a connection to metastore, current connections: 0&lt;BR /&gt;2019-09-16T13:11:22,350 INFO [main] results.QueryResultsCache: Initializing query results cache at /tmp/hive/_resultscache_&lt;BR /&gt;Hive Session ID = 8355ee16-bb99-439b-9351-581f999fc7be&lt;BR /&gt;2019-09-16T13:11:22,363 INFO [pool-6-thread-1] SessionState: Hive Session ID = 8355ee16-bb99-439b-9351-581f999fc7be&lt;BR /&gt;2019-09-16T13:11:22,378 INFO [main] results.QueryResultsCache: Query results cache: cacheDirectory /tmp/hive/_resultscache_/results-b1249629-b368-488f-b0fe-5473085778cd, maxCacheSize 2147483648, maxEntrySize 10485760, maxEntryLifetime 3600000&lt;BR /&gt;2019-09-16T13:11:22,382 INFO [pool-6-thread-1] session.SessionState: Created HDFS directory: hdfs://localhost:9000/hivetemp/scratchdir/shachatt1/8355ee16-bb99-439b-9351-581f999fc7be&lt;BR /&gt;2019-09-16T13:11:22,384 INFO [main] metastore.HiveMetaStoreClient: Trying to connect to metastore with URI thrift://localhost:9083&lt;BR /&gt;2019-09-16T13:11:22,384 INFO [main] metastore.HiveMetaStoreClient: Opened a connection to metastore, current connections: 1&lt;BR /&gt;2019-09-16T13:11:22,387 INFO [pool-6-thread-1] session.SessionState: Created local directory: /tmp/root/8355ee16-bb99-439b-9351-581f999fc7be&lt;BR /&gt;2019-09-16T13:11:22,395 INFO [pool-6-thread-1] session.SessionState: Created HDFS directory: hdfs://localhost:9000/hivetemp/scratchdir/shachatt1/8355ee16-bb99-439b-9351-581f999fc7be/_tmp_space.db&lt;BR /&gt;2019-09-16T13:11:22,405 INFO [main] metastore.HiveMetaStoreClient: Connected to metastore.&lt;BR /&gt;2019-09-16T13:11:22,405 INFO [main] metastore.RetryingMetaStoreClient: RetryingMetaStoreClient proxy=class org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient ugi=shachatt1 (auth:SIMPLE) retries=1 delay=1 lifetime=0&lt;BR /&gt;2019-09-16T13:11:22,479 INFO [main] events.NotificationEventPoll: Initializing lastCheckedEventId to 0&lt;BR /&gt;2019-09-16T13:11:22,600 INFO [pool-6-thread-1] metadata.HiveMaterializedViewsRegistry: Materialized views registry has been initialized&lt;BR /&gt;2019-09-16T13:11:22,606 INFO [main] util.log: Logging initialized @5482ms&lt;BR /&gt;2019-09-16T13:11:23,041 WARN [main] thrift.ThriftCLIService: XSRF filter disabled&lt;BR /&gt;2019-09-16T13:11:23,071 INFO [main] server.Server: jetty-9.3.20.v20170531&lt;BR /&gt;2019-09-16T13:11:23,099 INFO [main] handler.ContextHandler: Started o.e.j.s.ServletContextHandler@37854b34{/,null,AVAILABLE}&lt;BR /&gt;2019-09-16T13:11:23,111 INFO [main] server.AbstractConnector: Started ServerConnector@329548d0{HTTP/1.1,[http/1.1]}{0.0.0.0:10001}&lt;BR /&gt;2019-09-16T13:11:23,111 INFO [main] server.Server: Started @5988ms&lt;BR /&gt;2019-09-16T13:11:23,111 INFO [main] thrift.ThriftCLIService: Started ThriftHttpCLIService in http mode on port 10001 path=/cliservice/* with 5...500 worker threads&lt;BR /&gt;2019-09-16T13:11:23,113 INFO [main] server.Server: jetty-9.3.20.v20170531&lt;BR /&gt;2019-09-16T13:11:23,242 INFO [main] handler.ContextHandler: Started o.e.j.w.WebAppContext@5634a861{/,file:///tmp/jetty-0.0.0.0-10002-hiveserver2-_-any-1620856912156958300.dir/webapp/,AVAILABLE}{jar:file:/opt/hive/lib/hive-service-3.1.2.jar!/hive-webapps/hiveserver2}&lt;BR /&gt;2019-09-16T13:11:23,244 INFO [main] handler.ContextHandler: Started o.e.j.s.ServletContextHandler@2b0dc227{/static,jar:file:/opt/hive/lib/hive-service-3.1.2.jar!/hive-webapps/static,AVAILABLE}&lt;BR /&gt;2019-09-16T13:11:23,245 INFO [main] server.AbstractConnector: Started ServerConnector@221a2068{HTTP/1.1,[http/1.1]}{0.0.0.0:10002}&lt;BR /&gt;2019-09-16T13:11:23,245 INFO [main] server.Server: Started @6122ms&lt;BR /&gt;&lt;STRONG&gt;2019-09-16T13:11:23,245 INFO [main] http.HttpServer: Started HttpServer[hiveserver2] on port 10002&lt;/STRONG&gt;&lt;BR /&gt;2019-09-16T13:11:23,260 INFO [Thrift Server] thrift.ThriftCLIService: Caught InterruptedException. Shutting down thrift server.&lt;BR /&gt;2019-09-16T13:11:23,267 INFO [main] server.AbstractConnector: Stopped ServerConnector@329548d0{HTTP/1.1,[http/1.1]}{0.0.0.0:10001}&lt;BR /&gt;2019-09-16T13:11:23,268 INFO [main] handler.ContextHandler: Stopped o.e.j.s.ServletContextHandler@37854b34{/,null,UNAVAILABLE}&lt;BR /&gt;2019-09-16T13:11:23,268 INFO [main] thrift.ThriftCLIService: Thrift HTTP server has been stopped&lt;BR /&gt;2019-09-16T13:11:23,270 INFO [main] metastore.HiveMetaStoreClient: Closed a connection to metastore, current connections: 0&lt;BR /&gt;2019-09-16T13:11:23,273 INFO [main] server.AbstractConnector: Stopped ServerConnector@221a2068{HTTP/1.1,[http/1.1]}{0.0.0.0:10002}&lt;BR /&gt;2019-09-16T13:11:23,273 INFO [main] handler.ContextHandler: Stopped o.e.j.s.ServletContextHandler@2b0dc227{/static,jar:file:/opt/hive/lib/hive-service-3.1.2.jar!/hive-webapps/static,UNAVAILABLE}&lt;BR /&gt;2019-09-16T13:11:23,297 INFO [main] handler.ContextHandler: Stopped o.e.j.w.WebAppContext@5634a861{/,null,UNAVAILABLE}{jar:file:/opt/hive/lib/hive-service-3.1.2.jar!/hive-webapps/hiveserver2}&lt;BR /&gt;2019-09-16T13:12:22,650 INFO [NotificationEventPoll 0] metastore.HiveMetaStoreClient: Trying to connect to metastore with URI thrift://localhost:9083&lt;BR /&gt;2019-09-16T13:12:22,651 INFO [NotificationEventPoll 0] metastore.HiveMetaStoreClient: Opened a connection to metastore, current connections: 1&lt;BR /&gt;2019-09-16T13:12:22,653 INFO [NotificationEventPoll 0] metastore.HiveMetaStoreClient: Connected to metastore.&lt;BR /&gt;2019-09-16T13:12:22,654 INFO [NotificationEventPoll 0] metastore.RetryingMetaStoreClient: RetryingMetaStoreClient proxy=class org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient ugi=shachatt1 (auth:SIMPLE) retries=1 delay=1 lifetime=0&lt;BR /&gt;Hive Session ID = d9572012-0dda-4f90-87e3-8918b7edc9c3&lt;BR /&gt;2019-09-16T13:12:23,409 INFO [main] SessionState: Hive Session ID = d9572012-0dda-4f90-87e3-8918b7edc9c3&lt;BR /&gt;2019-09-16T13:12:23,424 INFO [main] session.SessionState: Created HDFS directory: hdfs://localhost:9000/hivetemp/scratchdir/shachatt1/d9572012-0dda-4f90-87e3-8918b7edc9c3&lt;BR /&gt;2019-09-16T13:12:23,426 INFO [main] session.SessionState: Created local directory: /tmp/root/d9572012-0dda-4f90-87e3-8918b7edc9c3&lt;BR /&gt;2019-09-16T13:12:23,431 INFO [main] session.SessionState: Created HDFS directory: hdfs://localhost:9000/hivetemp/scratchdir/shachatt1/d9572012-0dda-4f90-87e3-8918b7edc9c3/_tmp_space.db&lt;BR /&gt;2019-09-16T13:12:23,431 INFO [main] sqlstd.SQLStdHiveAccessController: Created SQLStdHiveAccessController for session context : HiveAuthzSessionContext [sessionString=d9572012-0dda-4f90-87e3-8918b7edc9c3, clientType=HIVESERVER2]&lt;BR /&gt;2019-09-16T13:12:23,432 WARN [main] session.SessionState: METASTORE_FILTER_HOOK will be ignored, since hive.security.authorization.manager is set to instance of HiveAuthorizerFactory.&lt;BR /&gt;2019-09-16T13:12:23,433 INFO [main] metastore.HiveMetaStoreClient: Trying to connect to metastore with URI thrift://localhost:9083&lt;BR /&gt;2019-09-16T13:12:23,433 INFO [main] metastore.HiveMetaStoreClient: Opened a connection to metastore, current connections: 2&lt;BR /&gt;2019-09-16T13:12:23,438 INFO [main] metastore.HiveMetaStoreClient: Connected to metastore.&lt;BR /&gt;2019-09-16T13:12:23,438 INFO [main] metastore.RetryingMetaStoreClient: RetryingMetaStoreClient proxy=class org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient ugi=shachatt1 (auth:SIMPLE) retries=1 delay=1 lifetime=0&lt;BR /&gt;2019-09-16T13:12:23,438 INFO [main] service.CompositeService: Operation log root directory is created: /tmp/root/operation_logs&lt;BR /&gt;2019-09-16T13:12:23,438 INFO [main] service.CompositeService: HiveServer2: Background operation thread pool size: 100&lt;BR /&gt;2019-09-16T13:12:23,438 INFO [main] service.CompositeService: HiveServer2: Background operation thread wait queue size: 100&lt;BR /&gt;2019-09-16T13:12:23,438 INFO [main] service.CompositeService: HiveServer2: Background operation thread keepalive time: 10 seconds&lt;BR /&gt;2019-09-16T13:12:23,438 INFO [main] service.CompositeService: Connections limit are user: 0 ipaddress: 0 user-ipaddress: 0&lt;BR /&gt;2019-09-16T13:12:23,552 INFO [main] metastore.HiveMetaStoreClient: Mestastore configuration metastore.filter.hook changed from org.apache.hadoop.hive.ql.security.authorization.plugin.AuthorizationMetaStoreFilterHook to org.apache.hadoop.hive.metastore.DefaultMetaStoreFilterHookImpl&lt;BR /&gt;2019-09-16T13:12:23,553 INFO [main] metastore.HiveMetaStoreClient: Closed a connection to metastore, current connections: 1&lt;BR /&gt;Hive Session ID = 9d75feed-93f6-4fd5-8bbd-da8808a21d5c&lt;BR /&gt;2019-09-16T13:12:23,573 INFO [pool-10-thread-1] SessionState: Hive Session ID = 9d75feed-93f6-4fd5-8bbd-da8808a21d5c&lt;BR /&gt;2019-09-16T13:12:23,651 INFO [pool-10-thread-1] session.SessionState: Created HDFS directory: hdfs://localhost:9000/hivetemp/scratchdir/shachatt1/9d75feed-93f6-4fd5-8bbd-da8808a21d5c&lt;BR /&gt;2019-09-16T13:12:23,662 INFO [pool-10-thread-1] session.SessionState: Created local directory: /tmp/root/9d75feed-93f6-4fd5-8bbd-da8808a21d5c&lt;BR /&gt;2019-09-16T13:12:23,698 INFO [pool-10-thread-1] session.SessionState: Created HDFS directory: hdfs://localhost:9000/hivetemp/scratchdir/shachatt1/9d75feed-93f6-4fd5-8bbd-da8808a21d5c/_tmp_space.db&lt;BR /&gt;&lt;STRONG&gt;2019-09-16T13:12:23,702 INFO [pool-10-thread-1] metastore.HiveMetaStoreClient: Trying to connect to metastore with URI thrift://localhost:9083&lt;/STRONG&gt;&lt;BR /&gt;2019-09-16T13:12:23,702 INFO [pool-10-thread-1] metastore.HiveMetaStoreClient: Opened a connection to metastore, current connections: 2&lt;BR /&gt;2019-09-16T13:12:23,717 WARN [main] thrift.ThriftCLIService: XSRF filter disabled&lt;BR /&gt;2019-09-16T13:12:23,717 INFO [main] server.Server: jetty-9.3.20.v20170531&lt;BR /&gt;2019-09-16T13:12:23,721 INFO [main] handler.ContextHandler: Started o.e.j.s.ServletContextHandler@67d32a54{/,null,AVAILABLE}&lt;BR /&gt;&lt;STRONG&gt;2019-09-16T13:12:23,723 INFO [main] server.AbstractConnector: Started ServerConnector@59edb4f5{HTTP/1.1,[http/1.1]}{0.0.0.0:10001}&lt;/STRONG&gt;&lt;BR /&gt;2019-09-16T13:12:23,723 INFO [main] server.Server: Started @66600ms&lt;BR /&gt;&lt;STRONG&gt;2019-09-16T13:12:23,723 INFO [main] thrift.ThriftCLIService: Started ThriftHttpCLIService in http mode on port 10001 path=/cliservice/* with 5...500 worker threads&lt;/STRONG&gt;&lt;BR /&gt;2019-09-16T13:12:23,724 INFO [pool-10-thread-1] metastore.HiveMetaStoreClient: Connected to metastore.&lt;BR /&gt;2019-09-16T13:12:23,724 INFO [pool-10-thread-1] metastore.RetryingMetaStoreClient: RetryingMetaStoreClient proxy=class org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient ugi=shachatt1 (auth:SIMPLE) retries=1 delay=1 lifetime=0&lt;BR /&gt;2019-09-16T13:12:23,732 INFO [main] server.Server: jetty-9.3.20.v20170531&lt;BR /&gt;2019-09-16T13:12:23,774 INFO [pool-10-thread-1] metadata.HiveMaterializedViewsRegistry: Materialized views registry has been initialized&lt;BR /&gt;2019-09-16T13:12:23,822 INFO [main] handler.ContextHandler: Started o.e.j.w.WebAppContext@3a401749{/,file:///tmp/jetty-0.0.0.0-10002-hiveserver2-_-any-8065703031579820150.dir/webapp/,AVAILABLE}{jar:file:/opt/hive/lib/hive-service-3.1.2.jar!/hive-webapps/hiveserver2}&lt;BR /&gt;2019-09-16T13:12:23,822 INFO [main] handler.ContextHandler: Started o.e.j.s.ServletContextHandler@7793ad58{/static,jar:file:/opt/hive/lib/hive-service-3.1.2.jar!/hive-webapps/static,AVAILABLE}&lt;BR /&gt;2019-09-16T13:12:23,823 INFO [main] server.AbstractConnector: Started ServerConnector@4f169009{HTTP/1.1,[http/1.1]}{0.0.0.0:10002}&lt;BR /&gt;2019-09-16T13:12:23,823 INFO [main] server.Server: Started @66700ms&lt;BR /&gt;&lt;STRONG&gt;2019-09-16T13:12:23,823 INFO [main] http.HttpServer: Started HttpServer[hiveserver2] on port &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;10002&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then when I run the program you provided, I get&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;python2 cloudera.py . (sample code provided by you:)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;[shachatt1@sharmi-dgov1 atlas_samples]$ python2 cloudera.py&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;File "cloudera.py", line 22, in &amp;lt;module&amp;gt;&lt;BR /&gt;output = hiveconnection(host_name, port, user,password, database)&lt;BR /&gt;File "cloudera.py", line 14, in hiveconnection&lt;BR /&gt;database=database, auth='CUSTOM')&lt;BR /&gt;File "/usr/lib/python2.7/site-packages/pyhive/hive.py", line 192, in __init__&lt;BR /&gt;self._transport.open()&lt;BR /&gt;File "/usr/lib/python2.7/site-packages/thrift_sasl/__init__.py", line 80, in open&lt;BR /&gt;status, payload = self._recv_sasl_message()&lt;BR /&gt;File "/usr/lib/python2.7/site-packages/thrift_sasl/__init__.py", line 101, in _recv_sasl_message&lt;BR /&gt;payload = read_all_compat(self._trans, length)&lt;BR /&gt;&lt;STRONG&gt;File "/usr/lib/python2.7/site-packages/thrift_sasl/six.py", line 31, in &amp;lt;lambda&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;read_all_compat = lambda trans, sz: trans.readAll(sz)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;File "/usr/lib64/python2.7/site-packages/thrift/transport/TTransport.py", line 60, in readAll&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;chunk = self.read(sz - have)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;File "/usr/lib64/python2.7/site-packages/thrift/transport/TSocket.py", line 132, in read&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;message='TSocket read 0 bytes')&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;thrift.transport.TTransport.TTransportException: TSocket read 0 bytes&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;and Corressponding HiveServer2 logs:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2019-09-16T13:17:42,539 WARN [HiveServer2-HttpHandler-Pool: Thread-56] http.HttpParser: Illegal character 0x1 in state=START for buffer HeapByteBuffer@7c6ba135[p=1,l=29,c=8192,r=28]={\x01&amp;lt;&amp;lt;&amp;lt;\x00\x00\x00\x05PLAIN\x02\x00\x00\x00\x0ehive\x00hive\x00hive&amp;gt;&amp;gt;&amp;gt;\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00}&lt;BR /&gt;2019-09-16T13:17:42,539 WARN [HiveServer2-HttpHandler-Pool: Thread-56] http.HttpParser: bad HTTP parsed: 400 Illegal character 0x1 for HttpChannelOverHttp@3d0722e6{r=0,c=false,a=IDLE,uri=null}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;cloudera.py&lt;/P&gt;&lt;P&gt;----------------&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;from pyhive import hive&lt;BR /&gt;import re,os, time&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;host_name = "localhost"&lt;BR /&gt;port = 10002&lt;BR /&gt;user = "hive"&lt;BR /&gt;password ="hive"&lt;BR /&gt;database = "default"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;def hiveconnection(host_name, port, user,password, database):&lt;BR /&gt;conn = hive.Connection(host=host_name, port=port, username=user, password=password,&lt;BR /&gt;database=database, auth='CUSTOM')&lt;BR /&gt;cur = conn.cursor()&lt;BR /&gt;cur.execute('select * from employees returns limit 5')&lt;BR /&gt;result = cur.fetchall()&lt;/P&gt;&lt;P&gt;return result&lt;/P&gt;&lt;P&gt;# Call above function&lt;BR /&gt;output = hiveconnection(host_name, port, user,password, database)&lt;BR /&gt;print(output)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 16 Sep 2019 13:45:14 GMT</pubDate>
    <dc:creator>ranger</dc:creator>
    <dc:date>2019-09-16T13:45:14Z</dc:date>
  </channel>
</rss>

