Support Questions

Find answers, ask questions, and share your expertise
Announcements
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: java.net.ConnectException: Connection timed out: connect
	at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:224) ~[hive-jdbc-2.3.4.jar:2.3.4]
	at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:107) ~[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 com.orange.SearchEngineHive.Repositories.SearchEngineRepo.getData(SearchEngineRepo.java:44) ~[classes/:na]




3 REPLIES 3

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 10.0.10.133 -Port 8080

ComputerName : 10.0.10.133

RemoteAddress : 10.0.10.133

RemotePort : 8080

InterfaceAlias : Ethernet 2

SourceAddress : 10.242.2.27

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.