---
title: "Property configuration of dataSource"
author: "boogie"
date: "2008-07-11T08:42:59Z"
tags: []
slug: "property-configuration-of-datasource"
draft: false
lastmod: "2008-07-11T08:42:59Z"
id: 213757
url: "https://boogie.iteye.com/blog/213757"
---

```
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