谁知道怎么通过JDBC让java连上hive?# DataSciences - 数据科学
t*u
1 楼
需要哪些lib/jar?
现在的问题是 DriverManager.getConnection("jdbc:hive2:// )
会报错
xception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/
conf/Configuration
at org.apache.hive.service.cli.thrift.EmbeddedThriftBinaryCLIService.<
init>(EmbeddedThriftBinaryCLIService.java:33)
at org.apache.hive.jdbc.HiveConnection.(HiveConnection.java:163)
at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:105)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:215)
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.conf.
Configuration
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 6 more
现在的问题是 DriverManager.getConnection("jdbc:hive2:// )
会报错
xception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/
conf/Configuration
at org.apache.hive.service.cli.thrift.EmbeddedThriftBinaryCLIService.<
init>(EmbeddedThriftBinaryCLIService.java:33)
at org.apache.hive.jdbc.HiveConnection.
at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:105)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:215)
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.conf.
Configuration
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 6 more