当前位置:网站首页>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操作了
边栏推荐
- /Bin/ld: cannot find -lssl
- Pyobject to char* (string)
- locate: 无法执行 stat () `/var/lib/mlocate/mlocate.db‘: 没有那个文件或目录
- floyed「建议收藏」
- Ssh/scp does not prompt all activities are monitored and reported
- 《大学“电路分析基础”课程实验合集.实验六》丨典型信号的观察与测量
- 6096. Success logarithm of spells and potions
- Ant group's large-scale map computing system tugraph passed the national evaluation
- 【LeetCode】1905-统计子岛屿
- /bin/ld: 找不到 -lpam
猜你喜欢

使用 percona 工具给 MySQL 表加字段中断后该如何操作

蚂蚁集团大规模图计算系统TuGraph通过国家级评测

可视化技术在 Nebula Graph 中的应用

二叉树前,中,后序遍历

Comparison between rstan Bayesian regression model and standard linear regression model of R language MCMC

全是精华的模电专题复习资料:基本放大电路知识点

爱可可AI前沿推介(7.2)

Aike AI frontier promotion (7.2)

《大学“电路分析基础”课程实验合集.实验七》丨正弦稳态电路的研究
![[leetcode] 417 - Pacific Atlantic current problem](/img/30/c541bc1e81eb4e348ca11116a05e84.png)
[leetcode] 417 - Pacific Atlantic current problem
随机推荐
/bin/ld: 找不到 -lgssapi_krb5
For the problem that Folium map cannot be displayed, the temporary solution is as follows
Pattern matching extraction of specific subgraphs in graphx graph Computing Practice
Strings and arrays
6091. Divide the array so that the maximum difference is K
Name of institution approved in advance
Introduction to dynamic planning I, BFS of queue (70.121.279.200)
/bin/ld: 找不到 -lssl
6090. 极大极小游戏
[leetcode] 1162 map analysis
隐藏在 Nebula Graph 背后的星辰大海
Add an empty column to spark dataframe - add an empty column to spark dataframe
2279. 装满石头的背包的最大数量
Moveit 避障路径规划 demo
Traversal before, during and after binary tree
[leetcode] 1020 number of enclaves
[leetcode] 283 move zero
Finally, I understand the event loop, synchronous / asynchronous, micro task / macro task, and operation mechanism in JS (with test questions attached)
Cultural scores of summer college entrance examination
2278. Percentage of letters in string