我尝试为Hive2 get错误运行JBDC代码.我有hive 1.2.0版hadoop 1.2.1版.但在命令行蜂巢和直线工作没有任何问题.但jdbc得到错误.
import java.sql.SQLException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.DriverManager;
public class HiveJdbcClient {
private static String driverName = "org.apache.hive.jdbc.HiveDriver";
/**
* @param args
* @throws SQLException
*/
public static void main(String[] args) throws SQLException {
//BasicConfigurator.configure();
try {
Class.forName(driverName);
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//replace "hive" here with the name of the user the queries should run as
Connection con = DriverManager.getConnection("jdbc:hive2://localhost:10000/default","", "");
Statement stmt = con.createStatement();
String …Run Code Online (Sandbox Code Playgroud) 我想要像这样的数组的总和
1 1 2 = 4
2 2 1 = 5
3 3 1 = 7
= = =
6 6 4
我想在html中使用java脚本打印这样的数组.