当前位置:网站首页>Boot 连接 Impala数据库
Boot 连接 Impala数据库
2022-07-02 12:28:00 【lvhui321】
1.在pom文件中集成驱动依赖
<dependency>
<groupId>com.cloudera.impala.jdbc</groupId>
<artifactId>ImpalaJDBC41</artifactId>
<version>2.5.41</version>
</dependency>
2.配置数据源,驱动名称,jdbc连接url
@Configuration
public class ImpalaSourceConfig {
@Value("${impala.driver_class_name}")
private String driverClassName;
@Value("${impala.jdbc_url}")
private String jdbcUrl;
@Bean(name = "impalaSource")
@Qualifier(value = "impalaSource")
public DataSource primaryDataSource() {
HikariConfig config = new HikariConfig();
config.setDriverClassName(driverClassName);
config.setJdbcUrl(jdbcUrl);
HikariDataSource dataSource = new HikariDataSource(config);
return dataSource;
}
@Bean(name = "jdbcTemplateImpala")
public JdbcTemplate jdbcTemplateImpala(@Qualifier("impalaSource") DataSource dataSource) {
return new JdbcTemplate(dataSource);
}
}
1)impala.driver_class_name=com.cloudera.impala.jdbc41.Driver
2)impala.jdbc_url=jdbc:impala://192.168.0.1:21050/impala_temp;UseSasl=0;AuthMech=3;UID=impala;PWD=
连接参数解释:
UseSasl为0不使用SASL认证。用户凭据仍会传递到服务器以获取Sentry等服务
UseSasl为1使用SASL身份验证
此属性指是否将SASL与用户名和密码验证机制(AuthMech=3)结合使用。
AuthMech为3用户名和密码
AuthMech为0不进行身份验证(默认)
AuthMech为1用于Kerberos
AuthMech为2用户名
此属性指的是使用的身份验证机制,将属性设置以上值的其中一个。
UID属性设置为适当的用户名,以访问Impala服务器。
PWD属性设置为与您提供的用户名相对应的密码。
3)连接配置注意属性区分大小写,不要在URL中重复配置属性
4)配置验证方式
(1)不需要验证把AuthMech属性设置为0,连接举例jdbc:impala://192.168.0.1:21050/impala_temp;AuthMech=0
(2)使用Kerberos进行验证,把AuthMech属性设置为1
(3)使用用户名密码进行验证,把AuthMech属性设置为3,连接举例jdbc:impala://192.168.0.1:21050/impala_temp;AuthMech=2;UID=impala;PWD=123
(4)使用用户名验证,把AuthMech属性设置为2,连接举例jdbc:impala://192.168.0.1:21050/impala_temp;AuthMech=2;UID=impala
3.接下来就可以使用mybatis做sql操作了
边栏推荐
- (Wanzi essence knowledge summary) basic knowledge of shell script programming
- Deux séquences ergodiques connues pour construire des arbres binaires
- C # get PLC information (kepserver) II
- Wise target detection 23 - pytoch builds SSD target detection platform
- Name of institution approved in advance
- SQL修改语句
- fastjson List转JSONArray以及JSONArray转List「建议收藏」
- College entrance examination admission score line climbing
- Pyinstaller's method of packaging pictures attached to exe
- 6091. 划分数组使最大差为 K
猜你喜欢
《大学“电路分析基础”课程实验合集.实验四》丨线性电路特性的研究
动态规划入门二(5.647.62)
Experiment collection of University "Fundamentals of circuit analysis". Experiment 4 - Research on linear circuit characteristics
基于 Nebula Graph 构建百亿关系知识图谱实践
隐藏在 Nebula Graph 背后的星辰大海
GraphX 图计算实践之模式匹配抽取特定子图
How to use percona tool to add fields to MySQL table after interruption
[leetcode] 1162 map analysis
(Video + graphic) machine learning introduction series - Chapter 5 machine learning practice
使用 percona 工具给 MySQL 表加字段中断后该如何操作
随机推荐
/bin/ld: 找不到 -lxslt
(Wanzi essence knowledge summary) basic knowledge of shell script programming
(Video + graphic) machine learning introduction series - Chapter 5 machine learning practice
Finally, I understand the event loop, synchronous / asynchronous, micro task / macro task, and operation mechanism in JS (with test questions attached)
Ssh/scp does not prompt all activities are monitored and reported
6095. Strong password checker II
使用 percona 工具给 MySQL 表加字段中断后该如何操作
[leetcode] 19 delete the penultimate node of the linked list
构建多架构镜像的最佳实践
6092. Replace elements in the array
动态规划入门一,队列的bfs(70.121.279.200)
中科大脑知识图谱平台建设及业务实践
QVariant与Json的各种纠葛——Qt
Digital collection system development (program development) - Digital Collection 3D modeling economic model system development source code
已知两种遍历序列构造二叉树
Add an empty column to spark dataframe - add an empty column to spark dataframe
Tree binary search tree
matlab中wavedec2,说说wavedec2函数[通俗易懂]
6090. 极大极小游戏
[leetcode] 1162 map analysis