Stefan Kendall
Stefan Kendall

Reputation: 67892

Grails can't connect to a datasource, but psql can?

Grails definition:

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 statement which can connect:
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

How could this possibly be happening?

More info: It looks like if I start grails from the machine running the database, startup works, but if I try from another machine, startup fails, despite psql connecting without issue.

Upvotes: 3

Views: 516

Answers (1)

Stefan Kendall
Stefan Kendall

Reputation: 67892

Looks like the DataSources.groovy definition had a bad entry, which caused the main connection bomb at the bottom of the stacktrace. Tracing all the way back up, I had a bad secondary datasource definition.

Upvotes: 2

Related Questions