简体   繁体   English

如何在 JDBC Sink Connector 中配置 hive-jdbc-uber-jar

[英]How to configure hive-jdbc-uber-jar in JDBC Sink Connector

I'm trying to use hive-jdbc-uber-jar and configure the JDBC sink connector.我正在尝试使用hive-jdbc-uber-jar并配置 JDBC 接收器连接器。

But the connector is throwing error:但连接器抛出错误:

[2022-08-31 00:21:21,583] INFO Unable to connect to database on attempt 1/3. Will retry in 10000 ms. (io.confluent.connect.jdbc.util.CachedConnectionProvider)
java.sql.SQLException: **No suitable driver** found for **jdbc:hive2**://XX.XX.XX.XX:10002/test;auth=noSasl;transportMode=http;httpPath=cliservice

Config配置

    {
      "name": "connector_schema_test_v01",
      "config": {
        "value.converter.schema.registry.url": "http://schema-registry:8081",
        "key.converter.schema.registry.url": "http://schema-registry:8081",
        "name": "connector_schema_test_v01",
        "connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector",
        "tasks.max": "1",
        "key.converter": "io.confluent.connect.avro.AvroConverter",
        "value.converter": "io.confluent.connect.avro.AvroConverter",
        "topics": "topic_schema_test_v05",
        "connection.url": "jdbc:hive2://XX.XX.XX.XX:10002/test;auth=noSasl;transportMode=http;httpPath=cliservice",
        "connection.user": "",
        "connection.password": "",
        "insert.mode": "upsert",
        "delete.enabled": "true",
        "table.name.format": "delta_try_v1_2",
        "pk.mode": "record_key",
        "pk.fields": "K1, K2",
        "auto.create": "true",
        "auto.evolve": "true"
      }
    }

The driver is in the path: /usr/share/confluent-hub-components/confluentinc-kafka-connect-jdbc/lib驱动程序在路径中:/usr/share/confluent-hub-components/confluentinc-kafka-connect-jdbc/lib

I have restart the connector, but same error.我已经重新启动连接器,但同样的错误。 I think driver class name has to be set in some property.我认为必须在某些属性中设置驱动程序 class 名称。

The driver and the URL are working in a SQL editor驱动程序和 URL 正在 SQL 编辑器中工作在此处输入图像描述

Any idea?任何想法?

The hive-jdbc-uber-jar project was created in 2014 and now comes with this warning: hive-jdbc-uber-jar 项目创建于 2014 年,现在带有以下警告:

When I first created this project in 2014 the Hive project did not produce a "standalone" jar that reliably contained all required dependencies to successfully create a JDBC connection.当我在 2014 年第一次创建这个项目时,Hive 项目没有生成一个“独立”jar,它可靠地包含了成功创建 Z82269B9B71AB4A7732F6958610214C4Z 连接所需的所有依赖项。 Since that time the community has resolved many, if not all, of those early issues.从那时起,社区已经解决了许多(如果不是全部)这些早期问题。 As of today, the "standalone" jar published by recent versions of Hive make this project mostly obsolete.截至今天,由 Hive 的最新版本发布的“独立”jar 使该项目大部分已过时。 You can grab the official Hive standalone jar using maven.您可以使用 maven 获取官方 Hive 独立 jar。

Perhaps you can just use Hive as follows and that will solve your issue:也许您可以按如下方式使用 Hive ,这将解决您的问题:

<dependency>
    <groupId>org.apache.hive</groupId>
    <artifactId>hive-jdbc</artifactId>
    <version>YOUR VERSION OF HIVE</version>
    <classifier>standalone</classifier>
</dependency>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM