Azure门户显示不正确的JDBC连接字符串 [英] Azure Portal displaying incorrect JDBC connection string

查看:101
本文介绍了Azure门户显示不正确的JDBC连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Azure门户中的连接字符串页面显示了我的PostgreSQL数据库的错误JDBC连接信息。

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

显示的连接字符串如下:

The connection string displayed is like:

jdbc:postgresql://xyz.postgres.database.azure.com:5432 / {your_database}?user = xyz @ xuz& password = {your_password}& sslmode = required

jdbc:postgresql://xyz.postgres.database.azure.com:5432/{your_database}?user=xyz@xuz&password={your_password}&sslmode=required

在使用官方PostgreSQL JDBC库的应用程序中使用它给出:

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

2019-01-29T20:17:18.227227679Z引起:org.springframework.jdbc.CannotGetJdbcConnectionException:失败获取JDBC连接;嵌套异常是org.postgresql.util.PSQLException:无效的sslmode值:required

2019-01-29T20:17:18.227231479Z      at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:81)〜[spring-jdbc-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]

2019-01-29T20:17:18.227235179Z      at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:319)〜[spring-jdbc-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]

2019-01-29T20:17:18.227238779Z      ...省略了70个常见框架

2019-01-29T20:17:18.227242180Z引起:org.postgresql.util.PSQLException:无效的sslmode值:必需

2019-01-29T20:17:18.227245880Z      at org.postgresql.jdbc.SslMode.of(SslMode.java:78)〜[postgresql-42.2.5.jar!/:42.2.5]

2019-01-29T20:17 :18.227249780Z      at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:149)~ [postgresql-42.2.5.jar!/:42.2.5]

2019-01-29T20 :17:18.227253480Z      at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)〜[postgresql-42.2.5.jar!/:42.2.5]

2019-01-29T20:17 :18.227257980Z      at org.postgresql.jdbc.PgConnection。(PgConnection.java:195)〜[postgresql-42.2.5.jar!/:42.2.5]

2019-01-29T20:17: 18.227261680Z      at org.postgresql.Driver.makeConnection(Driver.java:454)〜[postgresql-42.2.5.jar!/:42.2.5]

2019-01-29T20:17:18.227265180 ž      at org.postgresql.Driver.connect(Driver.java:256)~ [postgresql-42.2.5.jar!/:42.2.5]

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(DataSourceUtils.java:81) ~[spring-jdbc-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
2019-01-29T20:17:18.227235179Z     at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:319) ~[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(SslMode.java:78) ~[postgresql-42.2.5.jar!/:42.2.5]
2019-01-29T20:17:18.227249780Z     at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:149) ~[postgresql-42.2.5.jar!/:42.2.5]
2019-01-29T20:17:18.227253480Z     at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49) ~[postgresql-42.2.5.jar!/:42.2.5]
2019-01-29T20:17:18.227257980Z     at org.postgresql.jdbc.PgConnection.(PgConnection.java:195) ~[postgresql-42.2.5.jar!/:42.2.5]
2019-01-29T20:17:18.227261680Z     at org.postgresql.Driver.makeConnection(Driver.java:454) ~[postgresql-42.2.5.jar!/:42.2.5]
2019-01-29T20:17:18.227265180Z     at org.postgresql.Driver.connect(Driver.java:256) ~[postgresql-42.2.5.jar!/:42.2.5]

连接字符串页面中的sslmode参数值是'required`但是这应该是`require`(没有'd`)。

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

当它改为`require`时它按预期工作。

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

请注意,PostgreSQL文档(https://t.co/bRImR1ipRW?amp=1)也提到`require`而不是'required`。

Note that the PostgreSQL docs (https://t.co/bRImR1ipRW?amp=1) also mention `require` and not `required`.




推荐答案

注意: "连接字符串"中的
预定义 的连接字符串Azure门户中服务器下的设置包括使用SSL连接到数据库服务器的常用语言所需的参数。

SSL参数因连接器而异,例如"ssl = true";或"sslmode = require"或"sslmode = required"和其他变化。

有关详细信息,请参阅"在Azure数据库中为PostgreSQL配置SSL连接"。

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

希望这会有所帮助。


这篇关于Azure门户显示不正确的JDBC连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆