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

时间:2018-04-27 15:03:54

标签: java jdbc apache-kafka apache-kafka-connect confluent

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`"}

我已经为Microsoft SQL Server配置了Connect源,但成功和配置看起来非常相似。这里可能出现什么问题。

2 个答案:

答案 0 :(得分:1)

到目前为止,Kafka-Connect尚未提供AS400支持。如果需要AS400支持,请在JDBC连接器的db2方言下添加AS400并重建连接器

答案 1 :(得分:0)

现在,Kafka-jdbc-connector(合流)不支持DB2 AS400 / iseries。 如果要使用db2 AS400,请在as400的方言提供程序中添加“ as400 ”,在pom.xml中添加依赖项“ jt400 ”并加载“ com”。建立连接之前,请使用“ GenericDatabaseDialect”类中的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");
}