ITeye博客

Property configuration of dataSource

boogie · 2008-07-11 08:42 · Grails · Markdown

def props = new Properties()
InputStream is = new BufferedInputStream(new FileInputStream("${System.getenv("SITEHOME")}/config/cms.properties"))
props.load(is)
is.close()

environments {
    test {
        dataSource {
            dbCreate = "create" // one of 'create', 'create-drop','update'
            driverClassName = "org.hsqldb.jdbcDriver"
            url = "jdbc:hsqldb:mem:testDb"
            username = "sa"
            password = ""
        }
    }

    development {
        dataSource {
            driverClassName = props.get("dataSourcedriverClassName")
            url = props.get("dataSourceurl")
            username = props.get("dataSourceusername")
            password = props.get("dataSourcepassword")
            dialect = org.hibernate.dialect.MySQL5InnoDBDialect
        }
    }

    production {
        dataSource {
            driverClassName = props.get("dataSourcedriverClassName")
            url = props.get("dataSourceurl")
            username = props.get("dataSourceusername")
            password = props.get("dataSourcepassword")
            dialect = org.hibernate.dialect.MySQL5InnoDBDialect
        }
    }
}

 

http://www.nabble.com/Property-configuration-of-dataSource-connection-parameters-td18380697.html#a18380697

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。