davinci默认的数据源驱动配置文件中,只配置了mysql和oracle。但是jar只有mysql的驱动jar包,所以默认davinci只支持连接mysql数据源。
一、修改数据源驱动配置文件
(1)进入davinci安装目录中的config文件夹
cd $DAVINCI3_HOME/config
(2)修改数据源驱动配置模板
mv datasource_driver.yml.example datasource_driver.yml
(3)编辑数据源驱动,并追加内容(支持kylin和impala数据源)
vi datasource_driver.yml
#kylin:
# name: kylin
# desc: kylin
# driver: org.apache.kylin.jdbc.Driver
# keyword_prefix: \"
# keyword_suffix: \"
# alias_prefix: \"
# alias_suffix: \"
#impala:
# name: impala
# desc: impala
# driver: com.cloudera.impala.jdbc41.Driver
# keyword_prefix: \"
# keyword_suffix: \"
# alias_prefix: \"
# alias_suffix: \"
二、上传对应的驱动jar包到 $DAVINCI3_HOME/lib 目录
oracle、kylin、impala的驱动jar包,我已上传到网盘中。网盘的地址,在本套文章的第1章结尾处。
三、重启davinci
sh $DAVINCI3_HOME/bin/stop-server.sh
sh $DAVINCI3_HOME/bin/start-server.sh
至此你的davinci就支持4种数据源了
四、在davinci中配置数据源的连接字符串
(1)mysql格式
jdbc:mysql://IP:端口/库名
(2)oracle格式
jdbc:oracle:thin:@IP:端口:实例名
(3)kylin格式
jdbc:kylin://IP:端口/project名称
(4)impala格式
jdbc:impala://IP:端口/库名
附:连接oracle时
错误1:
2020-01-19 18:04:05.865 WARN 28651 --- [http-nio-192.168.8.102-8080-exec-7] c.a.druid.pool.DruidAbstractDataSource : oracle.jdbc.driver.OracleDriver is deprecated.Having use oracle.jdbc.OracleDriver.
2020-01-19 18:04:05.933 INFO 28651 --- [http-nio-192.168.8.102-8080-exec-7] com.alibaba.druid.pool.DruidDataSource : {dataSource-7} inited
licationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.isValid(I)Z
at com.alibaba.druid.pool.DruidPooledConnection.isValid(DruidPooledConnection.java:1043)
at edp.core.utils.SourceUtils.getConnection(SourceUtils.java:96)
at edp.core.utils.SqlUtils.testConnection(SqlUtils.java:673)
at edp.davinci.service.impl.SourceServiceImpl.testSource(SourceServiceImpl.java:404)
解决办法:
驱动包版本的问题 把ojdbc14换成ojdbc6即可
来源:oschina
链接:https://my.oschina.net/u/4362791/blog/4659296