我正在尝试使用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连接
发布评论