当前位置:网站首页>Boot connection to impala database
Boot connection to impala database
2022-07-02 15:54:00 【lvhui321】
1. stay pom Integration drive dependency in file
<dependency>
<groupId>com.cloudera.impala.jdbc</groupId>
<artifactId>ImpalaJDBC41</artifactId>
<version>2.5.41</version>
</dependency>
2. Configure data sources , Driver name ,jdbc Connect 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=
Explanation of connection parameters :
UseSasl by 0 Don't use SASL authentication . User credentials will still be passed to the server for Sentry Etc
UseSasl by 1 Use SASL Authentication
This attribute refers to whether SASL With user name and password authentication mechanism (AuthMech=3) Use a combination of .
AuthMech by 3 User name and password
AuthMech by 0 Authentication is not performed ( Default )
AuthMech by 1 be used for Kerberos
AuthMech by 2 user name
This attribute refers to the authentication mechanism used , Set the attribute to one of the above values .
UID Property to the appropriate user name , To visit Impala The server .
PWD Property to the password corresponding to the user name you provided .
3) Pay attention to case sensitivity in connection configuration , Not in URL Duplicate configuration properties
4) Configure authentication method
(1) There is no need to verify AuthMech Property is set to 0, Examples of connections jdbc:impala://192.168.0.1:21050/impala_temp;AuthMech=0
(2) Use Kerberos To verify , hold AuthMech Property is set to 1
(3) Use user name and password for authentication , hold AuthMech Property is set to 3, Examples of connections jdbc:impala://192.168.0.1:21050/impala_temp;AuthMech=2;UID=impala;PWD=123
(4) Use user name authentication , hold AuthMech Property is set to 2, Examples of connections jdbc:impala://192.168.0.1:21050/impala_temp;AuthMech=2;UID=impala
3. You can use mybatis do sql Operation
边栏推荐
猜你喜欢
Review materials for the special topic of analog electronics with all essence: basic amplification circuit knowledge points
已知兩種遍曆序列構造二叉樹
Experiment collection of University "Fundamentals of circuit analysis". Experiment 4 - Research on linear circuit characteristics
动态规划入门二(5.647.62)
解决** WARNING ** : Your ApplicationContext is unlikely to start due to a @ComponentScan of the defau
Nebula Graph & 数仓血缘关系数据的存储与读写
[development environment] install Visual Studio Ultimate 2013 development environment (download software | install software | run software)
动态规划入门一,队列的bfs(70.121.279.200)
如何实现十亿级离线 CSV 导入 Nebula Graph
Boot 事务使用
随机推荐
Solve the problem of base64encoder error
中科大脑知识图谱平台建设及业务实践
图数据库|Nebula Graph v3.1.0 性能报告
SQL FOREIGN KEY
Digital collection system development (program development) - Digital Collection 3D modeling economic model system development source code
SQL FOREIGN KEY
Locate: cannot execute stat() `/var/lib/mlocate/mlocate Db ': there is no such file or directory
XPT2046 四线电阻式触摸屏
解决BASE64Encoder报错的问题
College entrance examination admission score line crawler
【Salesforce】如何确认你的Salesforce版本?
构建多架构镜像的最佳实践
【idea】推荐一个idea翻译插件:Translation「建议收藏」
如何實現十億級離線 CSV 導入 Nebula Graph
Experiment collection of University "Fundamentals of circuit analysis". Experiment 7 - Research on sinusoidal steady-state circuit
How to use percona tool to add fields to MySQL table after interruption
Xpt2046 four wire resistive touch screen
Analysis of the difference between array and linked list
2303. Calculate the total tax payable
《大学“电路分析基础”课程实验合集.实验七》丨正弦稳态电路的研究