LoginSignup
9
9

More than 5 years have passed since last update.

Play2.2でHerokuのpostgresqlを利用する

Last updated at Posted at 2014-01-03

Play2.2でHerokuを利用する際、postgresqlへの接続にハマったのでメモ。

HerokuのpostgrtesqlアドオンはSSLで接続することが前提となっているので、db.XXX.urlに対して以下のように設定する必要がある。
この点は、調べた限りではherokuのドキュメントにもplayのドキュメントにも触れられていないっぽいので要注意。

application.conf(もしくはそれ以外のconfファイル)に以下のようにDB設定を行う。
ポイントは、urlに対して ssl=truesslfactory=org.postgresql.ssl.NonValidatingFactoryのパラメータを付けること。

db.default.url="jdbc:postgresql://<HOST>:5432/<DB_NAME>?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory"
db.default.user="<ROLE_NAME>"
db.default.password="<PASSWORD>"

参考

playframework - Postgresql with Play Framework - Stack Overflow

9
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
9