无效值java.sql.sqlexception:应用程序请求程序无法建立连接

v09wglhw  于 2021-06-06  发布在  Kafka
关注(0)|答案(2)|浏览(530)

ibm db2 as400的jdbc jar文件位于以下位置:

/confluent-4.1.0/share/java/kafka-connect-jdbc\jt400.jar

I am trying to configure the source file from Json file 
{ 
"name":"SOURCE_NAME", 
"config":{ 
"connector.class":"io.confluent.connect.jdbc.JdbcSourceConnector", 
"tasks.max":"1", 
"topic.prefix":"TOPIC_NAME", 
"connection.url":"jdbc:as400://IP_ADDRESS:PORT;libraries=DATABASE;", 
"connection.user":"USER_NAME", 
"connection.password":"PASSWORD", 
"key.converter": "io.confluent.connect.avro.AvroConverter", 
"key.converter.schema.registry.url": "http://localhost:8081", 
"value.converter": "io.confluent.connect.avro.AvroConverter", 
"value.converter.schema.registry.url": "http://localhost:8081", 
"log4j.logger.io.confluent.connect.jdbc":"DEBUG", 
"mode": "incrementing", 
"incrementing.column.name": "ID", 
"query": "SELECT * FROM TABLE", 
"poll.interval.ms": "60000", 
"batch.max.rows": "10000", 
"table.types": "TABLE", 
"plugin.path":"/confluent-4.1.0/share/java" 
} 
}

我犯了个错误

{"error_code":400,"message":"Connector configuration is invalid and contains the following 2 error(s): 
Invalid value java.sql.SQLException: The application requester cannot establish the connection. (Connection refused (Connection refused)) for configuration Couldn't open connection to jdbc:as400://IP_ADDRESS:PORT/DATABASE 
Invalid value java.sql.SQLException: The application requester cannot establish the connection. (Connection refused (Connection refused)) for configuration Couldn't open connection to jdbc:as400://IP_ADDRESS:PORT/DATABASE 
You can also find the above list of errors at the endpoint `/{connectorType}/config/validate`"}

我成功地为microsoftsqlserver配置了connect源代码,而且配置看起来非常相似。这里可能出了什么问题。

qmelpv7a

qmelpv7a1#

到目前为止,kafka connect还没有提供as400支持。如果您需要as400支持,请在jdbc连接器中的db2方言下添加as400并重建连接器

r1wp621o

r1wp621o2#

现在kafka jdbc连接器(confluent)不支持db2as400/iseries。如果要使用DB2AS400,请在as400方言提供程序中添加“as400”,在pom.xml中添加dependecy“jt400”,并在建立连接之前在“genericdatabasedialect”类中加载“com.ibm.as400.access.as400jdbcdriver”。在db2方言中添加提供者

public Provider() {
  super(Db2DatabaseDialect.class.getSimpleName(), "db2", "db2j", "ibmdb","as400");
}

在通用数据库方言中添加as400 jdbc驱动程序

try {
  Class.forName("com.ibm.as400.access.AS400JDBCDriver");
} catch (ClassNotFoundException e) {
  throw new SQLException("AS400JDBC Driver Not found");
}

相关问题