简体   繁体   English

将Jhipster远程连接到Postgres

[英]Connecting jhipster remotely to postgres

I'm trying to configure jhipster to work with heroku's postgres database. 我正在尝试将jhipster配置为与heroku的postgres数据库一起使用。 Here are my database parameters with credentials redacted: 这是删除了凭据的数据库参数:

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

It results in this error that I determined is because I need to enable SSL: 这导致我确定此错误是因为我需要启用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

According to heroku, remote database connections require JDBC connection URL with two SSL parameters. 根据heroku的说法,远程数据库连接需要具有两个SSL参数的JDBC连接URL。 I have not been able to configure this URL successfully. 我无法成功配置此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. 如果您使用的是Heroku Postgres数据库,则可以远程连接该数据库以进行维护和调试。 However doing so requires that you use an SSL connection. 但是,这样做需要使用SSL连接。 Your JDBC connection URL will need to include the following: ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory 您的JDBC连接URL将需要包括以下内容:ssl = true&sslfactory = org.postgresql.ssl.NonValidatingFactory

I figured out how to format the credentials for remote postgres connection 我想出了如何格式化远程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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM