【问题标题】:Talend Connection to PostgreSQL Database failsTalend 与 PostgreSQL 数据库的连接失败
【发布时间】:2021-03-06 11:30:42
【问题描述】:

我正在尝试使用 Talend Open Studio for Big Data v7.3.1 连接到位于远程服务器中的 PostgreSQL 数据库 问题是服务器需要 SSL 证书。我尝试了很多方法,但仍然失败。 这是我尝试过的连接字符串和 TOS BD 中的日志错误

1) 使用 ssl 模式禁用 jdbc:postgresql://xx.xx.xx.xx:5432/dbName?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory&sslmode=disable

Exception in component tDBConnection_1 (DB_Connection)
org.postgresql.util.PSQLException: FATAL: pg_hba.conf rejects connection for host "my.ip.address.here", user "user", database "databasename", SSL off

2)不指定ssl模式(表示采用默认模式)jdbc:postgresql://xx.xx.xx.xx:5432/dbName?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory

org.postgresql.ssl.PGjdbcHostnameVerifier verify
GRAVE: Server name validation failed: hostname xx.xx.xx.xx does not match common name xxxxx
Exception in component tDBConnection_1 (DB_Connection)
org.postgresql.util.PSQLException: The hostname xx.xx.xx.xx could not be verified by 
hostnameverifier PgjdbcHostnameVerifier

3)如果我在连接中省略 SSL 参数部分,例如 jdbc:postgresql://xx.xx.xx.xx:5432/dbName?,它会要求提供有效的客户端证书。

注意:我可以使用 pgadmin 连接到数据库,但问题在于 Talend open Studio

【问题讨论】:

    标签: postgresql ssl ssl-certificate etl talend


    【解决方案1】:

    解决方案是将证书位置放在连接字符串中并指定 ssl 模式:

    ssl=true&sslmode=prefer&sslcert=DirectoryToSslCertificates/client.crt&sslkey=DirectoryToSslCertificates/clientkey.pk8&sslrootcert=DirectoryToSslCertificates/root.crt

    (别忘了用 openssl 命令更改证书格式,我有 .pem 文件)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多