For my application I need dynamic database connections at runtime. I know, there are ways to create multiple datasources but they are not that dynamically I think. Scenari
As long as you have the JDBC drivers for all the datasources on your classpath, you can create an instance of groovy.sql.Sql
that will connect to whatever database you like, e.g.
Sql sql = Sql.newInstance('jdbc:hsqldb:mem:testDB', 'sa', 'myPassword',
'org.hsqldb.jdbc.JDBCDriver')
// now use the Sql instance to execute a query, or whatever....