postgresql - 将 jhipster 远程连接到 postgres

标签 postgresql ssl heroku jdbc jhipster

我正在尝试配置 jhipster 以使用 heroku 的 postgres 数据库。以下是我的数据库参数以及经过编辑的凭据:

spring:
    profiles: dev
    datasource:
        dataSourceClassName: org.postgresql.ds.PGSimpleDataSource
        url:
        databaseName: xxxx
        serverName: ec2-54-225-182-133.compute-1.amazonaws.com
        username: xxxx
        password: xxxx

它导致这个错误,我确定是因为我需要启用 SSL:

[DEBUG] com.john_g_shultz.site.config.DatabaseConfiguration - Configuring Datasource
[ERROR] com.zaxxer.hikari.HikariPool - Maximum connection creation retries exceeded: FATAL: no pg_hba.conf entry for host "72.69.103.36", user "xxxxxx", database "xxxxxx", SSL off

根据heroku,远程数据库连接需要带有两个SSL参数的JDBC连接URL。我无法成功配置此 URL。

Connecting to a database remotely

If you’re using a Heroku Postgres database you can connect to it remotely for maintenance and debugging purposes. However doing so requires that you use an SSL connection. Your JDBC connection URL will need to include the following: ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory

最佳答案

我想出了如何格式化远程 postgres 连接的凭据

spring:
    profiles: dev
    datasource:
        dataSourceClassName: org.postgresql.ds.PGSimpleDataSource
        url: jdbc:postgresql://HOSTNAME/DATABASENAME?user=xxxx&password=xxxx&ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory
        databaseName:
        serverName:
        username: xxxx
        password: xxxx

关于postgresql - 将 jhipster 远程连接到 postgres,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23727974/

相关文章:

postgresql - 通过与 postgresql 中的其他列分组,将多个 JSONArray 行合并为一行

c++ - SSL_connect 在 Windows 上导致 SSL_ERROR_SYSCALL 和 WSAENOTCONN

android - Android中的OkHttp Mutual SSL

node.js - [ MongoNetworkError ],当我在 Heroku 上部署时,应用程序无法连接到 mongoDB

google-app-engine - Appengine/Amazon/Heroku 实例如何工作?

reactjs - 将服务器端渲染添加到 Firebase 上托管的现有 React+Redux+React-Router 应用程序

ruby-on-rails - 将模型属性限制为 Rails 中的值列表的方法是什么?

json - 在子选择中过滤 jsonb 结果

ruby - bundle 安装的 ssl 证书失败

python - Libssl 和 libcrypto 导致 dyld : Library not loaded:/usr/lib/libpq. 5.dylib