Support Questions

Find answers, ask questions, and share your expertise
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

how to connect from local application to distant hive?

Hello Team, I'm working in my windows machine on an application that need to coonect to hive tables which created in distant redhat machine. I m using java spring boot. I m tring to cionnect using:

Connection connection = DriverManager.getConnection("jdbc:hive2://my_machine_hostname:10000/mydatabase", "my_username", "mypassword");
and I get this error:

java.sql.SQLException: Could not open client transport with JDBC Uri: jdbc:hive2://my_machine_hostname:10000/my_database: Connection timed out: connect
	at org.apache.hive.jdbc.HiveConnection.<init>( ~[hive-jdbc-2.3.4.jar:2.3.4]
	at org.apache.hive.jdbc.HiveDriver.connect( ~[hive-jdbc-2.3.4.jar:2.3.4]
	at java.sql.DriverManager.getConnection(Unknown Source) ~[na:1.8.0_191]
	at java.sql.DriverManager.getConnection(Unknown Source) ~[na:1.8.0_191]
	at ~[classes/:na]


Super Collaborator

Hi @chaouki trabelsi,

please check the firewall in windows server to accept the connections from hive

you can simple check by using below syntax from powershell.

Test-NetConnection hiveserver-ip -Port 10000

if the connection status false then you need to check the firewall in bothsides (Linux+windows)

Hello @subhash parise, Thank's for replying, Test-NetConnection didn't work in powershell, so I tried Test-Connection and it works when I ping the ip of server (without the port).

How can I check the firewall? Because when I put "firewall-cmd --state" and "systemctl status firewalld" on my remote machine (Redhat 7) i got an error message saying that these commands are not found.

Super Collaborator

Hi @chaouki trabelsi,

Please find the below example:

Test-NetConnection -Port 8080

ComputerName :

RemoteAddress :

RemotePort : 8080

InterfaceAlias : Ethernet 2

SourceAddress :

TcpTestSucceeded : True

TcpTestSucceeded should be true. if it false you need to open the ports in firewalls.

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.