当前位置:网站首页>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 -llz4
- 如何實現十億級離線 CSV 導入 Nebula Graph
- College entrance examination admission score line crawler
- 《大学“电路分析基础”课程实验合集.实验七》丨正弦稳态电路的研究
- [salesforce] how to confirm your salesforce version?
- [idea] recommend an idea translation plug-in: translation "suggestions collection"
- Traversal before, during and after binary tree
- Introduction to dynamic planning I, BFS of queue (70.121.279.200)
- Add an empty column to spark dataframe - add an empty column to spark dataframe
- 已知兩種遍曆序列構造二叉樹
猜你喜欢
智联招聘的基于 Nebula Graph 的推荐实践分享
How to import a billion level offline CSV into Nepal graph
动态规划入门一,队列的bfs(70.121.279.200)
Comment réaliser un graphique Nebula d'importation CSV hors ligne de niveau milliard
[leetcode] 1905 statistics sub Island
《大学“电路分析基础”课程实验合集.实验七》丨正弦稳态电路的研究
Review materials for the special topic of analog electronics with all essence: basic amplification circuit knowledge points
XPT2046 四线电阻式触摸屏
隐藏在 Nebula Graph 背后的星辰大海
使用 percona 工具给 MySQL 表加字段中断后该如何操作
随机推荐
Locate: cannot execute stat() `/var/lib/mlocate/mlocate Db ': there is no such file or directory
树-二叉搜索树
(4) Flink's table API and SQL table schema
【Salesforce】如何确认你的Salesforce版本?
全是精华的模电专题复习资料:基本放大电路知识点
Fastjson list to jsonarray and jsonarray to list "suggested collections"
/Bin/ld: cannot find -lssl
[idea] recommend an idea translation plug-in: translation "suggestions collection"
【LeetCode】1905-统计子岛屿
How to import a billion level offline CSV into Nepal graph
基于 Nebula Graph 构建百亿关系知识图谱实践
[leetcode] 977 square of ordered array
PHP static members
动态规划入门二(5.647.62)
Experiment collection of University Course "Fundamentals of circuit analysis". Experiment 5 - Research on equivalent circuit of linear active two terminal network
[leetcode] 577 reverse word III in string
Moveit 避障路径规划 demo
Finally, I understand the event loop, synchronous / asynchronous, micro task / macro task, and operation mechanism in JS (with test questions attached)
/Bin/ld: cannot find -llz4
Make p12 certificate [easy to understand]