Azure Portal displaying incorrect JDBC connection string RRS feed

  • Question

  • The Connection string page in the Azure Portals shows the wrong JDBC connection info for my PostgreSQL database.

    The connection string displayed is like:


    Using this in a application using the official PostgreSQL JDBC library gives:

    2019-01-29T20:17:18.227227679Z Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is org.postgresql.util.PSQLException: Invalid sslmode value: required
    2019-01-29T20:17:18.227231479Z     at org.springframework.jdbc.datasource.DataSourceUtils.getConnection( ~[spring-jdbc-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
    2019-01-29T20:17:18.227235179Z     at ~[spring-jdbc-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
    2019-01-29T20:17:18.227238779Z     ... 70 common frames omitted
    2019-01-29T20:17:18.227242180Z Caused by: org.postgresql.util.PSQLException: Invalid sslmode value: required
    2019-01-29T20:17:18.227245880Z     at org.postgresql.jdbc.SslMode.of( ~[postgresql-42.2.5.jar!/:42.2.5]
    2019-01-29T20:17:18.227249780Z     at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl( ~[postgresql-42.2.5.jar!/:42.2.5]
    2019-01-29T20:17:18.227253480Z     at org.postgresql.core.ConnectionFactory.openConnection( ~[postgresql-42.2.5.jar!/:42.2.5]
    2019-01-29T20:17:18.227257980Z     at org.postgresql.jdbc.PgConnection.( ~[postgresql-42.2.5.jar!/:42.2.5]
    2019-01-29T20:17:18.227261680Z     at org.postgresql.Driver.makeConnection( ~[postgresql-42.2.5.jar!/:42.2.5]
    2019-01-29T20:17:18.227265180Z     at org.postgresql.Driver.connect( ~[postgresql-42.2.5.jar!/:42.2.5]

    The sslmode param value in the connection string page is `required` but this should be `require` (without `d`).

    When changing it to `require` it works as expected.

    Note that the PostgreSQL docs ( also mention `require` and not `required`.

    Tuesday, January 29, 2019 8:44 PM

All replies

  • Note: Connection strings that are pre-defined in the "Connection Strings" settings under your server in the Azure portal include the required parameters for common languages to connect to your database server using SSL.

    The SSL parameter varies based on the connector, for example "ssl=true" or "sslmode=require" or "sslmode=required" and other variations.

    For more details, refer “Configure SSL connectivity in Azure Database for PostgreSQL”.

    Hope this helps.

    Thursday, January 31, 2019 4:05 AM
  • Thx.

    I understand it's a *pre-defined* value.

    For the official PostgreSQL JDBC driver the correct value is "sslmode=require" so I wonder why the pre-defined example is "required". Doesn't make sense, or am I wrong?

    Sunday, February 3, 2019 2:23 PM
  • Yes, I understand it should be “require” for PostgreSQL JDBC.

    In general, Azure portal includes the required parameters for common languages to connect to your database server using SSL.

    Tuesday, February 5, 2019 4:47 AM