尝试连接到postgresql数据库时,我一直收到身份验证错误。以下是具体错误:
[error] c.j.b.h.AbstractConnectionHook - Failed to obtain initial connection Sleeping for 0ms and trying again. Attempts left: 0. Exception: null.Message:FATAL: password authentication failed for user
我已经检查并仔细检查了用户名和密码,所以这不是问题。我能够使用psql成功连接到这个相同的数据库。这是我的application.conf看起来像
# Database configuration
# ~~~~~
# You can declare as many datasources as you want.
# By convention, the default datasource is named `default`
#
# db.default.driver=org.h2.Driver
# db.default.url="jdbc:h2:mem:play"
# db.default.user=sa
# db.default.password=""
#Database configuration using PostgreSQL database engine
db.default.driver=org.postgresql.Driver
db.default.url="jdbc:postgresql://website.com/database"
db.default.user="username"
db.default.password="password")
# Evolutions
# ~~~~~
# You can disable evolutions if needed
# evolutionplugin=disabled
# Logger
# ~~~~~
# You can also configure logback (http://logback.qos.ch/),
# by providing an application-logger.xml file in the conf directory.
# Root logger:
logger.root=ERROR
# Logger used by the framework:
logger.play=INFO
# Logger provided to your application:
logger.application=DEBUG
68,0-1 Bot
感谢您的见解!
答案 0 :(得分:1)
db.default.password="password")
)是打字错误? 如果没有,请将其删除并重试。
答案 1 :(得分:0)
db.default.driver="org.postgresql.Driver"
db.default.url="postgres://username:password@localhost:5432/mydb"
这对我来说很好,我没有使用db.default.user
和db.default.password