2014-05-18 89 views
2

我試圖配置jhipster與heroku的postgres數據庫一起使用。這裏用的憑據我的數據庫參數節錄:將jgster遠程連接到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的,遠程數據庫連接需要JDBC連接URL有兩個SSL參數。我無法成功配置此網址。

連接到數據庫遠程

如果您正在使用的Heroku Postgres數據庫,你可以連接到它 遠程進行維護和調試。但是這樣做 要求您使用SSL連接。你的JDBC連接URL將 需要包括以下內容: SSL =真& sslfactory = org.postgresql.ssl.NonValidatingFactory

回答

1

我想通了,如何格式化遠程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