前言
- 公司最近有个需求需要在已有项目中接入
星环大数据 关系型分析引擎
数据库 - 这个数据库魔改自
hive
但没有说具体版本 - 官方文档 中的 java 接入案例不适用于 spring-boot 项目
- 经过不断的尝试最终找到了适用与此数据库的集成方式整理如下
集成方法
-
驱动版本
hive-jdbc:0.14.0
hadoop-client:0.23.11
-
driver-class
org.apache.hive.jdbc.HiveDriver
-
jdbc-url
jdbc:hive2://localhost:10000/test
-
重点 maven 配置
<dependency> <groupId>org.apache.hive</groupId> <artifactId>hive-jdbc</artifactId> <version>0.14.0</version> <exclusions> <exclusion> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> </exclusion> <exclusion> <groupId>org.apache.hive</groupId> <artifactId>hive-shims</artifactId> </exclusion> <exclusion> <groupId>org.glassfish</groupId> <artifactId>javax-el</artifactId> </exclusion> <exclusion> <groupId>org.eclipse.jetty.aggregate</groupId> <artifactId>jetty-all</artifactId> </exclusion> <exclusion> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-client</artifactId> <version>0.23.11</version> <exclusions> <exclusion> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> </exclusion> </exclusions> </dependency>
接入例子
- 例子集成了多数据源
- 代码下载地址 transwarp-springboot
- 下载后修改
application.yml
为自己的数据库配置即可运行 - 运行后请求
localhost:8080/allTable
即可验证
来源链接:https://www.cnblogs.com/heei/p/18807674
没有回复内容