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 JDBC : Could not open client transport with JDBC Uri

Solved Go to solution

Hive JDBC : Could not open client transport with JDBC Uri

New Contributor

Hello,

I tried to connect to hive using jdbc but i had the following error:

Error: Could not open client transport with JDBC Uri: jdbc:hive2://server:10000/;principal=<Server_Principal_of_HiveServer2> java.net.ConnectException: Connection refused (state=08S01,code=0)

I got the same error from beeline : beeline -u 'jdbc:hive2://server:10000/;principal=<Server_Principal_of_HiveServer2>'

I will be thankfull for your help.

thanks

Hive version: 1.2.1

HDP: 2.3

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Hive JDBC : Could not open client transport with JDBC Uri

Rising Star

is your hive Server is running in HTTP mode?

Connection URL When HiveServer2 Is Running in HTTP Mode:-

jdbc:hive2://<host>:<port>/<db>;transportMode=http;httpPath=<http_endpoint>

where:-

<http_endpoint> is the corresponding HTTP endpoint configured in hive-site.xml. Default value is cliservice.

Default port for HTTP transport mode is 10001.

10 REPLIES 10

Re: Hive JDBC : Could not open client transport with JDBC Uri

Expert Contributor

Have you checked if hive services are running? Also server name is correct?

Re: Hive JDBC : Could not open client transport with JDBC Uri

Is this a kerberos enabled cluster?

Highlighted

Re: Hive JDBC : Could not open client transport with JDBC Uri

Rising Star

is your hive Server is running in HTTP mode?

Connection URL When HiveServer2 Is Running in HTTP Mode:-

jdbc:hive2://<host>:<port>/<db>;transportMode=http;httpPath=<http_endpoint>

where:-

<http_endpoint> is the corresponding HTTP endpoint configured in hive-site.xml. Default value is cliservice.

Default port for HTTP transport mode is 10001.

Re: Hive JDBC : Could not open client transport with JDBC Uri

Rising Star

I may be able to provide analysis if you can post any error in hive server2 log.

First thing is to check if hive server2 is up and running properly.

Re: Hive JDBC : Could not open client transport with JDBC Uri

Mentor

@Ahmed Missaoui can you accept the best answer to close this thread?

Re: Hive JDBC : Could not open client transport with JDBC Uri

New Contributor
  1. Kill your hiveserver2 & metastore & Restart them again.
  2. check hiveserver2 & metastore are running using 'jps' command.
  3. Run "root@hostname~]# beeline -u jdbc:hive2://localhost:10000/" .
  4. if still getting this error then replace "localhost" with "hostname " of step 3
  • These above steps has worked for me.

Re: Hive JDBC : Could not open client transport with JDBC Uri

Expert Contributor

These can be few reasons :

1) other instance of database may be running .

2) namenode might be in safe mode

3) common localhost:9000 connection refused error.

Best way is to check the hive logs and debug it.

Re: Hive JDBC : Could not open client transport with JDBC Uri

Expert Contributor

This happened to me. What I did was connect run the command below from beeline:

beeline> !connect jdbc:hive2://

Then, will ask for my user and pass, and i'm connected to my hive.

I'm having issues now connecting to hiveserver from Hue and Ambari View thou. :(

EDIT:

I have 2 hiveserver2, hive metastore and webhcat servers.

Re: Hive JDBC : Could not open client transport with JDBC Uri

New Contributor

Hi All,

HiveServer2 is constantly going down and it works max for a day when we restart. The following is the error from hiveserver2 log when it is down.

Connection failed on host ip-172-30-5-146.us-west-2.compute.internal:10000 (Traceback (most recent call last): File "/var/lib/ambari-agent/cache/common-services/HIVE/0.12.0.2.0/package/alerts/alert_hive_thrift_port.py", line 200, in execute check_command_timeout=int(check_command_timeout)) File "/usr/lib/python2.6/site-packages/resource_management/libraries/functions/hive_check.py", line 74, in check_thrift_port_sasl timeout=check_command_timeout) File "/usr/lib/python2.6/site-packages/resource_management/core/base.py", line 154, in __init__ self.env.run() File "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", line 160, in run self.run_action(resource, action) File "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", line 124, in run_action provider_action() File "/usr/lib/python2.6/site-packages/resource_management/core/providers/system.py", line 238, in action_run tries=self.resource.tries, try_sleep=self.resource.try_sleep) File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 70, in inner result = function(command, **kwargs) File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 92, in checked_call tries=tries, try_sleep=try_sleep) File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 140, in _call_wrapper result = _call(command, **kwargs_copy) File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 291, in _call raise Fail(err_msg) Fail: Execution of '! beeline -u 'jdbc:hive2://ip-172-30-5-146.us-west-2.compute.internal:10000/;transportMode=binary' -e '' 2>&1| awk '{print}'|grep -i -e 'Connection refused' -e 'Invalid URL'' returned 1. Error: Could not open client transport with JDBC Uri: jdbc:hive2://ip-172-30-5-146.us-west-2.compute.internal:10000/;transportMode=binary: java.net.ConnectException: Connection refused (state=08S01,code=0) Error: Could not open client transport with JDBC Uri: jdbc:hive2://ip-172-30-5-146.us-west-2.compute.internal:10000/;transportMode=binary: java.net.ConnectException: Connection refused (state=08S01,code=0)