Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dataSource_target {
- dialect = org.hibernate.dialect.MySQLInnoDBDialect
- pooled = true
- jmxExport = true
- driverClassName = "com.mysql.jdbc.Driver"
- username = "bla"
- password = "bla"
- }
- static mapping = {
- datasource 'ALL'
- }
- con = new Sql(dataSource_target)
- rows = con.rows(sql)
- dataSource_target {
- dialect = org.hibernate.dialect.MySQLInnoDBDialect
- pooled = true
- jmxExport = true
- driverClassName = "com.mysql.jdbc.Driver"
- username = "bla"
- password = "bla"
- properties {
- maxActive = -1
- minEvictableIdleTimeMillis=1800000
- timeBetweenEvictionRunsMillis=1800000
- numTestsPerEvictionRun=3
- testOnBorrow=true
- testWhileIdle=true
- testOnReturn=true
- validationQuery="SELECT 1"
- }
- }
- def db = [
- url:'jdbc:hsqldb:mem:testDB',
- user:'sa',
- password:'',
- driver:'org.hsqldb.jdbc.JDBCDriver'
- ]
- def sql = Sql.newInstance(db.url, db.user, db.password, db.driver)
- def db = [:]
- def dataSources = Holders.grailsApplication.config.dataSources
- db.user = dataSources.dataSource_otherDsn.username
- db.password = dataSources.dataSource_otherDsn.password
- db.driver = dataSources.dataSource_otherDsn.driverClassName
- if (Environment.current == Environment.DEVELOPMENT) {
- db.url = Holders.grailsApplication.config.environments.development.dataSources.dataSource_otherDsn.url
- } else if (Environment.current == Environment.PRODUCTION) {
- db.url = Holders.grailsApplication.config.environments.production.dataSource.dataSource_otherDsn.url
- }
- def sql = Sql.newInstance(db.url, db.user, db.password, db.driver)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement