问题描述
try{//TODOAuto-generatedmethodstubClass.forName("org.apache.hadoop.hive.jdbc.HiveDriver");Connectioncon=DriverManager.getConnection("jdbc:hive://192.168.1.102:10000/default","","");System.out.println(con);}catch(Exceptione){e.printStackTrace();}java.sql.SQLException:Couldnotestablishconnectionto192.168.1.102:10000/default:java.net.ConnectException:Connectiontimedout:connectatorg.apache.hadoop.hive.jdbc.HiveConnection.<init>(HiveConnection.java:117)atorg.apache.hadoop.hive.jdbc.HiveDriver.connect(HiveDriver.java:106)atjava.sql.DriverManager.getConnection(DriverManager.java:582)atjava.sql.DriverManager.getConnection(DriverManager.java:185)atcom.hit.hive.HiveTest.main(HiveTest.java:29)
解决方案
解决方案二:
链接超时,自己先ping一下看看是不是连得上呀
解决方案三:
谢谢!已经解决了,I在hosts文件中添加IP映射,然后用映射名