Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nz1gG-0007Wv-IV for pgsql-jdbc@arkaria.postgresql.org; Wed, 08 Jun 2022 19:49:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nz1gF-0006ig-I3 for pgsql-jdbc@arkaria.postgresql.org; Wed, 08 Jun 2022 19:49:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nz0Lo-0003Fs-D0 for pgsql-jdbc@lists.postgresql.org; Wed, 08 Jun 2022 18:24:16 +0000 Received: from mail-qk1-x72d.google.com ([2607:f8b0:4864:20::72d]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nz0Lm-0000LM-5t for pgsql-jdbc@lists.postgresql.org; Wed, 08 Jun 2022 18:24:16 +0000 Received: by mail-qk1-x72d.google.com with SMTP id a184so12560351qkg.5 for ; Wed, 08 Jun 2022 11:24:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:content-language:to:from :subject; bh=LJdAk96aNCu6ZkoglmDD8v3jPyY9IdpvAEDF2GWrh7A=; b=mvwRiUF02IYLICO8GGgbXrdbQPh86iZSE8QjwJzitohdHDlyZ0RAst8JtHpDCZoy3K uxExaFeJb/VK00v4l6WOKdxrMIYq4I4S3EXoQNUWQa0aQcKoNSEX+CUfFiJLRzp5dw8L alhyCBOksYoHIzrdZH87FRpWkEK9XnOqGqioZ963NR9VVLtlzQg6HeAfyTqD8Qj9jLNQ 4CtUjgPOrBra27geyI34Bv2FwBA+OrcFRYwWbsDrvNdAaEqwrbgKvdB8p/0Qmu42ZKuz DqLa/T7LqkebDQbvevVJKvMGjp+ObidJhv+UlUoBkjZlonTWnM9YxmV5dGODD/0WK9pk 1xQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:from:subject; bh=LJdAk96aNCu6ZkoglmDD8v3jPyY9IdpvAEDF2GWrh7A=; b=fuHvaH43JyMyHjJpbPlKQf+r4CwLxp69WI/xzFOKTJcx+7Eh38ByOksCvaYknxVuFX r5fg7ncCmMSf8J2zqAWK46bS7yi3RQjgI/J8HXqgi2xZgjE9a/b4HhhPlBgoMRkuautD Hs6cev3Pv2l5uF6thAI8wueEMczE3CSO/Fxhnzmee3UiFi5ODxJpoADSTmmeEjX5WBbY 0fY0I3d/4xpIR5YEfqy8tQ2IQYFjC56ouwF8gisZfITubOm/LIadR3jWSyjlFqdsZ2NZ kkihItJhimX1UWZ1Bts3Q+YnaUa3jmcWhEzTNJe/zpFNum0d4QuhjHIS7OrrjD32HiOB GZDQ== X-Gm-Message-State: AOAM533KUHapaUMwRIsZwp5Sqk7JGD/98oZ54/2fk3Rx2J75Qp7/wTux AIUzZPEYQDpOT7v9y525gfbu69XvP+blgw== X-Google-Smtp-Source: ABdhPJzY+cIL+MUQmfHnjSr7i7H6FB3Uzm9Y5v9cL9O0m+sSe+Cfu7Vtq48jvF9zEE4jrTvcBbPLKw== X-Received: by 2002:a37:c24c:0:b0:6a6:b923:b782 with SMTP id j12-20020a37c24c000000b006a6b923b782mr12179770qkm.748.1654712651256; Wed, 08 Jun 2022 11:24:11 -0700 (PDT) Received: from [192.168.1.127] (cpe-174-109-143-5.nc.res.rr.com. [174.109.143.5]) by smtp.gmail.com with ESMTPSA id l18-20020a05620a28d200b006a6d365e9b1sm5997335qkp.57.2022.06.08.11.24.10 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 08 Jun 2022 11:24:10 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------nt0m5guEVI0DPLSxNyn0Bgcd" Message-ID: Date: Wed, 8 Jun 2022 14:24:09 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Content-Language: en-US To: pgsql-jdbc@lists.postgresql.org From: Ben Pracht Subject: Can't connect to Postgres on GCP, except through DataGrip List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------nt0m5guEVI0DPLSxNyn0Bgcd Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi, I'm developing a Spring Boot application that needs to connect to a GCP hosted Postgres Database. The only program capable of connecting is JetBrains DataGrip. The problem with this is that I won't know how to connect from a Java development program if I cannot even get my SQL client to work because SSL is so hard to work with. DataGrip: Reports the DB is Postgres 14.2. DataGrip used JDBC driver 42.3.3, JDBC4.2. Authentication is User & Password User: myuser-dev Password: hidden Database: mydatabase URL: jdbc:postgresql://xx.xx.xx.xx:5432/myuser-dev Connection type: default SSH tunne:l is unchecked Use SSL: is checked CA file: postgres-server-ca.pem Client certificate file: postgres-client-cert.pem Client key file: postgres-client-key.pem Mode: Require  (other choices are Verify-CA and Full Verification) DBeaver: Use SSL: is checked CA certificate: postgres-server-ca.pem Client Certificate: postgres-client-cert.pem Client Private Key: postgres-client-key.pem SSL mode: verify-ca (tried require) Driver: postgresql-42.3.6 DBeaver gives me this irrating: "unable to find valid certification path to requested target" "SSL error: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target   PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target   PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target     unable to find valid certification path to requested target     unable to find valid certification path to requested target" Yes, I've tried copying the post gres-server-ca.pem file into the cacerts file in the JDK that DBeaver uses. It doesn't care. Nor do I think I should have to do anything like that. The idea that the SSL trust certificate signed by Google isn't a valid trusted cert is assinine. But I did it because someone is going to insist that's the problem. Btw, all the certs were generated /by GCP/. I have no idea what type these are. I just want to connect. I don't want to fight this thing. Thanks for your help. Ben --------------nt0m5guEVI0DPLSxNyn0Bgcd Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi,
I'm developing a Spring Boot application that needs to connect to a GCP hosted Postgres Database. The only program capable of connecting is JetBrains DataGrip.

The problem with this is that I won't know how to connect from a Java development program if I cannot even get my SQL client to work because SSL is so hard to work with.

DataGrip:
Reports the DB is Postgres 14.2. DataGrip used JDBC driver 42.3.3, JDBC4.2.
Authentication is User & Password
User: myuser-dev
Password: hidden
Database: mydatabase
URL: jdbc:postgresql://xx.xx.xx.xx:5432/myuser-dev
Connection type: default
SSH tunne:l is unchecked
Use SSL: is checked
CA file: postgres-server-ca.pem
Client certificate file: postgres-client-cert.pem
Client key file: postgres-client-key.pem
Mode: Require  (other choices are Verify-CA and Full Verification)

DBeaver:
Use SSL: is checked
CA certificate: postgres-server-ca.pem
Client Certificate: postgres-client-cert.pem
Client Private Key: postgres-client-key.pem
SSL mode: verify-ca (tried require)
Driver: postgresql-42.3.6

DBeaver gives me this irrating:
"unable to find valid certification path to requested target"
"SSL error: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
  PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
  PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    unable to find valid certification path to requested target
    unable to find valid certification path to requested target"

Yes, I've tried copying the post gres-server-ca.pem file into the cacerts file in the JDK that DBeaver uses. It doesn't care. Nor do I think I should have to do anything like that. The idea that the SSL trust certificate signed by Google isn't a valid trusted cert is assinine. But I did it because someone is going to insist that's the problem. Btw, all the certs were generated by GCP. I have no idea what type these are. I just want to connect. I don't want to fight this thing.

Thanks for your help.
Ben




--------------nt0m5guEVI0DPLSxNyn0Bgcd--