gpt4 book ai didi

postgresql - 远程连接 jhipster 到 postgres

转载 作者:行者123 更新时间:2023-11-29 12:21:05 25 4
gpt4 key购买 nike

我正在尝试配置 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com