1

I am trying to connect a database over SSL(namely TLSv1.3).

When tested with psql, it connects over TLSv1.3.

With JDBC driver as below, the connection is not secured by SSL at all for some reason.

(confirmed this by executing select * from pg_stat_ssl;)

      val props = new Properties()
      props.setProperty("user", "postgres")
      props.setProperty("password", "example")
      props.setProperty("ssl", "true")
      props.setProperty("sslmode", "allow")
      props.setProperty("sslfactory", "org.postgresql.ssl.NonValidatingFactory")
      DriverManager.getConnection("jdbc:postgresql://localhost/", props)

What would be the cause of this problem?

PostgreSQL JDBC driver versions: 42.2.5/42.2.22

1 Answer 1

2

If you set sslmode to allow, the client will prefer non-encrypted connections. Change the setting to require or prefer.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.