# Unable to connect to Posdtgres db

**URL:** <https://forum.cloverdx.com/t/unable-to-connect-to-posdtgres-db/1541>\
**Category:** CloverDX Platform\
**Created:** [January 7, 2015, 12:00am UTC](https://forum.cloverdx.com/t/unable-to-connect-to-posdtgres-db/1541 "2015-01-07T00:00:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![gal](https://avatars.discourse-cdn.com/v4/letter/g/e480ec/32.png) [@gal](https://forum.cloverdx.com/u/gal)\
**Post date:** [January 7, 2015, 12:00am UTC](https://forum.cloverdx.com/t/unable-to-connect-to-posdtgres-db/1541/1 "2015-01-07T00:00:00Z")

</div>

Hi,

I’m new to CloverETL, and I’m trying to connect to the db for the first time.  
I need ssl to be on. I tried using the following connection string in the URL secrion of the DB connection:  
jdbc:postgresql://localhost:port/db?&ssl=true

But I received the following error message  
“Can’t connect to DB: SSL error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target”

I also tried to set the parameter ssl to true on the advanced section., but then it didn’t recognized the ssl parameter:  
“Can’t connect to DB: FATAL: no pg\_hba.conf entry for host “10.30.0.85”, user “dbuser”, database “db”, SSL off”

Please advice.

Thanks!  
Gal

---

<div class="post-metadata">

**Author:** ![slechtaj](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@slechtaj](https://forum.cloverdx.com/u/slechtaj)\
**Post date:** [January 9, 2015, 5:18pm UTC](https://forum.cloverdx.com/t/unable-to-connect-to-posdtgres-db/1541/2 "2015-01-09T17:18:58Z")

</div>

Hi Gal,

You need to provide Clover with certificate of the DB Server. You can import such certificate into your own truststore and tell Clover to use that one. In order to do so you need to put the following arguments into graph run configuration (_Run_ -\> _Run Configuration_ -\> _Arguments_ tab → _VM arguments_ text-area):

```auto
-Djavax.net.ssl.trustStore=<PATH_TO_YOUR_TRUSTSTORE>
-Djavax.net.ssl.trustStorePassword=<TRUSTSTORE_PASSWORD>

```

Hope this helps.

---

<div class="post-metadata">

**Author:** ![gal](https://avatars.discourse-cdn.com/v4/letter/g/e480ec/32.png) [@gal](https://forum.cloverdx.com/u/gal)\
**Post date:** [January 10, 2015, 12:24am UTC](https://forum.cloverdx.com/t/unable-to-connect-to-posdtgres-db/1541/3 "2015-01-10T00:24:00Z")

</div>

Hi,

Is this mandatory? I’m using a cloud based db and having problems getting it’s certificate.  
After setting the following connection variables (jdbc.ssl=true, jdbc.sslfactory=org.postgresql.ssl.NonValidatingFactory) - I recieve a “Connection valid” info message when I validate the connection.  
However when I try to use the connection in order to extract METADATA or in order to connect to a DBOutputTable, I get the following error: “Can’t connect to DB:FATAL: no pg\_hba.cong entry for host \<host\_ip\>” , user “\<user\_name\>, database \<db\_name\>, SSL off”.

Why is SSL off when I try to use the connection? In the advanced variables for the connection it is set to ssl=true and the validation works.

Thanks  
Gal

---

<div class="post-metadata">

**Author:** ![gal](https://avatars.discourse-cdn.com/v4/letter/g/e480ec/32.png) [@gal](https://forum.cloverdx.com/u/gal)\
**Post date:** [January 12, 2015, 5:07pm UTC](https://forum.cloverdx.com/t/unable-to-connect-to-posdtgres-db/1541/4 "2015-01-12T17:07:54Z")

</div>

I’ve added the path to the certificate, but I’m still getting the same error message - the tool doesn’t try to use ssl connection.

---

<div class="post-metadata">

**Author:** ![slechtaj](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@slechtaj](https://forum.cloverdx.com/u/slechtaj)\
**Post date:** [January 12, 2015, 5:35pm UTC](https://forum.cloverdx.com/t/unable-to-connect-to-posdtgres-db/1541/5 "2015-01-12T17:35:32Z")

</div>

Hi Gal,

you might use NonValidatingFactory in this case ([Using SSL](http://jdbc.postgresql.org/documentation/81/ssl-client.html)). The thing is that you wrote the properties with “jdbc.” prefix as there is supposed to be used just “ssl” and “sslfactory”. That is also why you see “SSL off” in the message. You can also paste these parameters into the URL.

Hope this helps.

---

<div class="post-metadata">

**Author:** ![gal](https://avatars.discourse-cdn.com/v4/letter/g/e480ec/32.png) [@gal](https://forum.cloverdx.com/u/gal)\
**Post date:** [January 12, 2015, 6:35pm UTC](https://forum.cloverdx.com/t/unable-to-connect-to-posdtgres-db/1541/6 "2015-01-12T18:35:55Z")

</div>

I’ve attached a screenshot that shows the current configuration. I’m still getting “SSL off” message

- [Screenshot 2015-01-12 10.27.40.jpg](https://cdn.cloverdx.com/forum/17961%5Fd3b678491ab3e7a59dbe865cb9b7cd6b/Screenshot%5F2015-01-12%5F10.27.40.jpg)

---

<div class="post-metadata">

**Author:** ![imriskal](https://avatars.discourse-cdn.com/v4/letter/i/b38774/32.png) [@imriskal](https://forum.cloverdx.com/u/imriskal)\
**Post date:** [January 13, 2015, 2:16pm UTC](https://forum.cloverdx.com/t/unable-to-connect-to-posdtgres-db/1541/7 "2015-01-13T14:16:35Z")

</div>

Hi Gal,

I have a few notes to your screenshot.

1. JDBC properties is not the right place for setting path to your trust store. As my colleague Jan mentioned, trust store should be set via run configuration and it is valid for the whole JVM. (Run → Run Configuration → Arguments tab → VM arguments) Or in case of CloverETL Server, it should be set in setenv script.
2. You are setting path to a certificate instead of path to trust store. And you also need to set a password to it. See the following page to see [the difference between certificate and key store](http://stackoverflow.com/questions/4022604/java-how-to-obtain-keystore-file-for-a-certification-crt-file).
3. If **ssl** and **sslfactory** in “Custom JDBC properties” properties did not work, move them into your JDBC URL as parameters.

I hope this helps.

Regards,

---

<div class="post-metadata">

**Author:** ![gal](https://avatars.discourse-cdn.com/v4/letter/g/e480ec/32.png) [@gal](https://forum.cloverdx.com/u/gal)\
**Post date:** [January 13, 2015, 7:30pm UTC](https://forum.cloverdx.com/t/unable-to-connect-to-posdtgres-db/1541/8 "2015-01-13T19:30:20Z")

</div>

Thanks! Setting the URL with the parameters worked:  
connection URL: jdbc:postgresql://localhost:port/db?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory
