无法在Apache Airflow中设置DB2/DashDB JDBC连接

编程入门 行业动态 更新时间:2024-10-28 00:18:49
本文介绍了无法在Apache Airflow中设置DB2/DashDB JDBC连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试使用Airflow UI创建DB2/DashDB连接.我添加了db2jcc4.jar驱动程序,并提供了路径以及类名com.ibm.db2.jcc.DB2Driver.class

I'm trying to create a DB2 / DashDB connection using the Airflow UI. I have added the db2jcc4.jar driver and provided the path as well as the class name com.ibm.db2.jcc.DB2Driver.class

我试图运行一个简单的查询(在临时用户界面中),并且总是得到相同的错误

I tried to run a simple query (in the ad hoc UI) and always get the same error

java.lang.RuntimeException:找不到类com.ibm.db2.jcc.DB2Driver.class

java.lang.RuntimeException: Class com.ibm.db2.jcc.DB2Driver.class not found

有人需要在Apache Airflow中建立DB2/DashDB连接吗?

Did anybody need to setup a DB2 / DashDB connection in Apache Airflow before?

在网络上什么都没找到.

Found nothing on the web about that.

谢谢

推荐答案

如果您还没有弄清楚这一点,我就会遇到同样的问题.

If you haven't still figured this out, I ran into same problem.

经过一些调试,我发现这里的文件jdbc_hook.py github/apache/incubator-airflow/blob/master/airflow/hooks/jdbc_hook.py#L55 缺少jaydebeapi.connect方法调用中预期的1个参数.

With some debugging I came to find that the file jdbc_hook.py here github/apache/incubator-airflow/blob/master/airflow/hooks/jdbc_hook.py#L55 is missing 1 parameter expected in the jaydebeapi.connect method call.

特别是缺少第二个参数,该参数应该是连接的URL.

In particular is missing the second parameter, which should be the URL of the connection.

我将方法get_conn中的代码更改为以下代码以进行尝试,并且成功了.

I changed the code inside the method get_conn to the following to try out, and it worked.

def get_conn(self): ...... conn = jaydebeapi.connect(jdbc_driver_name, host, driver_args=[str(login), str(psw)], jars=jdbc_driver_loc) return conn

请注意将host添加到对jaydebeapi.connect的调用中.

Notice the host added to the call to jaydebeapi.connect.

我当时想开一家公关公司,但随后进行审查,发现它们已经在几个地方有了(在Airflow的公关公司中搜索jdbc):

I was thinking of opening a PR, but then reviewing, they have already something in a couple of places (search for jdbc in Airflow's PRs):

github/apache/incubator-airflow/pull/2227

更多推荐

无法在Apache Airflow中设置DB2/DashDB JDBC连接

本文发布于:2023-11-24 11:07:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1624956.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Airflow   Apache   JDBC   DashDB

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!