How to set database in Grails 3? Manual looks obsolete here: http://grails.github.io/grails-doc/3.0.x/guide/single.html#dataSource
since it gives an example of setting with grove code like follows:
dataSource {
pooled = true
dbCreate = "update"
url = "jdbc:mysql://localhost:3306/my_database"
driverClassName = "com.mysql.jdbc.Driver"
dialect = org.hibernate.dialect.MySQL5InnoDBDialect
username = "username"
password = "password"
...
while I have application.yml
with
dataSource:
pooled: true
jmxExport: true
driverClassName: org.h2.Driver
username: sa
password:
What method is up to date?
Here's a current postgres example with multiple datasources. I found that the redundancy was necessary because there were some discrepancies in the levels that grails, spring and hibernate were expecting to see config information. this satisfied all of them. also include a runtime dependency for your jdbc driver. for postgres, it was
[Start of application.yml file. yes, the '---' lines need to be there. they keep the configslurper from getting confused.]
As of grails 3.2.2 with GORM 6, the grails documentation is current and correct and this "extra" config shown in the first answer date Apr 7 is no longer necessary. An example dataSource config is: