当前位置:网站首页>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操作了
边栏推荐
- fastjson List转JSONArray以及JSONArray转List「建议收藏」
- [leetcode] 167 - sum of two numbers II - enter an ordered array
- Aiko ai Frontier promotion (7.2)
- Fastjson list to jsonarray and jsonarray to list "suggested collections"
- Wise target detection 23 - pytoch builds SSD target detection platform
- 隐藏在 Nebula Graph 背后的星辰大海
- Postgressql stream replication active / standby switchover primary database no read / write downtime scenario
- matlab中wavedec2,说说wavedec2函数[通俗易懂]
- [leetcode] 486 predict winners
- [leetcode] 200 number of islands
猜你喜欢

基于 Nebula Graph 构建百亿关系知识图谱实践
![[leetcode] 417 - Pacific Atlantic current problem](/img/30/c541bc1e81eb4e348ca11116a05e84.png)
[leetcode] 417 - Pacific Atlantic current problem
![[leetcode] 1254 - count the number of closed Islands](/img/84/f888ae0e164951cd9623fb3bf4a984.png)
[leetcode] 1254 - count the number of closed Islands

Introduction to dynamic planning I, BFS of queue (70.121.279.200)
![[development environment] install Visual Studio Ultimate 2013 development environment (download software | install software | run software)](/img/26/3f19d36c048e669c736e27384e0fa7.jpg)
[development environment] install Visual Studio Ultimate 2013 development environment (download software | install software | run software)

Experiment collection of University Course "Fundamentals of circuit analysis". Experiment 5 - Research on equivalent circuit of linear active two terminal network

已知两种遍历序列构造二叉树

PTA ladder game exercise set l2-001 inter city emergency rescue

Finally, I understand the event loop, synchronous / asynchronous, micro task / macro task, and operation mechanism in JS (with test questions attached)

【LeetCode】1905-统计子岛屿
随机推荐
Experiment collection of University "Fundamentals of circuit analysis". Experiment 7 - Research on sinusoidal steady-state circuit
[leetcode] 877 stone game
Cultural scores of summer college entrance examination
Use ffmpeg command line to push UDP and RTP streams (H264 and TS), and ffplay receives
[leetcode] 1254 - count the number of closed Islands
Strings and arrays
《大学“电路分析基础”课程实验合集.实验五》丨线性有源二端网络等效电路的研究
/bin/ld: 找不到 -lxslt
智联招聘的基于 Nebula Graph 的推荐实践分享
Make p12 certificate [easy to understand]
SQL FOREIGN KEY
Aiko ai Frontier promotion (7.2)
如何实现十亿级离线 CSV 导入 Nebula Graph
动态规划入门二(5.647.62)
SQL修改语句
SQL modification statement
《大学“电路分析基础”课程实验合集.实验七》丨正弦稳态电路的研究
(Video + graphic) machine learning introduction series - Chapter 5 machine learning practice
6090. Minimax games
[leetcode] 189 rotation array