Grails 定义:
development {
dataSource {
driverClassName = "org.postgresql.Driver"
dialect = org.hibernate.dialect.PostgreSQLDialect
pooled = false
jndiName = null
url = "jdbc:postgresql://10.197.6.214:5432/mydatabase"
dbCreate = "create-drop"
username = "myusername"
password = "password"
}
}
可以连接的psql语句:
psql -h 10.197.6.214 -d mydatabase -U myusername
pg_hba.conf文件:
# IPv4 local connections:
host all all 0.0.0.0/0 trust
# IPv6 local connections:
host all all ::1/128 md5
postgresql.conf
listen_addresses = '*'
port=5432
这怎么可能发生呢?
更多信息: 看起来如果我从运行数据库的计算机启动grails,启动就可以正常工作,但如果我从另一台计算机尝试,则启动会失败,尽管psql连接没有问题。
Caused by: org.springframework.jdbc.support.MetaDataAccessException: Could not get Connection for extracting meta data; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is acceptaing TCP/IP connections.
- Stefan Kendall