运行环境
jdk1.8
springboot:2.7.15
1.在pom.xml文件中加入
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.3.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.hive/hive-jdbc -->
<!--Hive 配置-->
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-jdbc</artifactId>
<version>2.1.1</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
<exclusion>
<artifactId>log4j-1.2-api</artifactId>
<groupId>org.apache.logging.log4j</groupId>
</exclusion>
<exclusion>
<artifactId>log4j-core</artifactId>
<groupId>org.apache.logging.log4j</groupId>
</exclusion>
<exclusion>
<artifactId>log4j-slf4j-impl</artifactId>
<groupId>org.apache.logging.log4j</groupId>
</exclusion>
<exclusion>``
<artifactId>log4j-web</artifactId>
<groupId>org.apache.logging.log4j</groupId>
</exclusion>
<exclusion>
<artifactId>slf4j-log4j12</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
<exclusion>
<artifactId>jetty-runner</artifactId>
<groupId>org.eclipse.jetty</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
2.application.yml配置
spring:
datasource:
hikari:
jdbc-url: jdbc:hive2://192.168.88.101(你的服务器地址):10000/myhive
driver-class-name: org.apache.hive.jdbc.HiveDriver
username: hadoop
password: 123456
3.Test
@SpringBootTest
class HiveApplicationTests {
@Resource
private ScoreService scoreService;
@Test
void contextLoads() {
List<Score> list = scoreService.list();
System.out.println(list);
}
}
运行结果
标签:jdbc,logging,Spring,Boot,hive,apache,org,log4j From: https://www.cnblogs.com/ysk0904/p/17660888.html