前提
#node4
nohup bin/hive --service metastore &
nohup bin/hiveserver2 &
创建java项目
导入本地驱动包
驱动包在
F:\qq\qq文件\学习软件\hive-3.1.2-bin\apache-hive-3.1.2-bin\jdbc
第一步
Window–Preferences(预设)–Java–Build Path–User Libraries
点New,输入hive,点ok,点击右边Add External JARs…按钮
找到本地驱动包路径选中
最后点击下边Apply And Close(保存并关闭)
第二步
右击项目,点击最下面的Properties(属性)点击Java Build Path
选中Libraties
jdbc的代码
package com.jinghangzz.hive.jdbc;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement