They will be different connections. This is a standard issue with Grails in that you can only have one DataSource.groovy and so only one linked to GORM. There are ways around this but it is mostly a matter of what you need at the time.
If you wanted to connect to a entirely different DataSource you could set up something like this in your Config.groovy (not perfect but effective enough).
environments {
production {
grails.serverURL = "http://localhost:8080/${appName}"
grails.databaseDriverClassName = "oracle.jdbc.driver.OracleDriver"
grails.databaseURL = "jdbc:oracle:thin:@<servername>:1521:<sid>"
grails.databaseUsername = "<username>"
grails.databasePassword = "<password>"
}
development {
grails.serverURL = "http://localhost:8080/${appName}"
grails.databaseDriverClassName = "oracle.jdbc.driver.OracleDriver"
grails.databaseURL = "jdbc:oracle:thin:@<servername>:1521:<sid>"
grails.databaseUsername = "<username>"
grails.databasePassword = "<password>"
}
test {
grails.serverURL = "http://localhost:8080/${appName}"
grails.databaseDriverClassName = "oracle.jdbc.driver.OracleDriver"
grails.databaseURL = "jdbc:oracle:thin:@<servername>:1521:<sid>"
grails.databaseUsername = "<username>"
grails.databasePassword = "<password>"
}
}
Then in your service simply call it like so:
import org.codehaus.groovy.grails.commons.*
class SomeService {
boolean transactional = true
def config = ConfigurationHolder.config
// set up the Sql object
def sql = groovy.sql.Sql.newInstance(
config.grails.databaseURL,
config.grails.databaseUsername,
config.grails.databasePassword,
config.grails.databaseDriverClassName)