I am new to Grails and I have doubts. Suppose I have mine Datasource.groovyconfigured for a database mysql. Everything works fine and the grails app works.
In the controller, if I want to add / change the database that I installed in Datasource.groovy, how can I do this?
Again I need to do something like this in each controller:
def db = Sql.newInstance(
'jdbc:mysql://*****',
'root',
'',
'com.mysql.jdbc.Driver'
)
to get a db instance that I point to a Datasource.groovyfile?
Are there any recommendations for this?
source
share