簡體   English   中英

與 PostgreSQL 數據庫的 Talend 連接失敗

[英]Talend Connection to PostgreSQL Database fails

我正在嘗試使用 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

解決方案是將證書位置放在連接字符串中並指定 ssl 模式:

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

(不要忘記使用 openssl 命令更改證書格式,我有 .pem 文件)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM