Wednesday, September 19, 2012

Grails + Weblogic 10.3 JDBC Datasources

When deploying Grails applications in a production environment, utilizing the Weblogic application server JDBC dataSouces through Java EE JNDI is highly recommended. By using the datasource you offload the responsibility of connection pooling and tuning to the application server. In addition, personally I have found it makes maintenance safer and easier for developers since your datasource is coupled to it's environment rather than to the application. This was part of a requirement I recently had and the details seemed to be overlooked in the Grails books I had at my disposal. Here is an example of DataSource.groovy in a Weblogic 10.3 / Oracle 11g environment.


DataSource.groovy:



environments {
test {
             dataSource {
pooled = true
dialect = "org.hibernate.dialect.Oracle10gDialect"
driverClassName = "oracle.jdbc.driver.OracleDriver"
jndiName = "jdbc/myDataSource"
             }
     }
}

No comments:

Post a Comment