Using a JNDI Data Source

Before packaging our application for deployment, we need to change our data source. Open TekDays/grails-app/conf/DataSource.groovy.

When we last worked on this file, it looked something like this:

 
dataSource {
 
pooled = true
 
driverClassName = ​"com.mysql.jdbc.Driver"
 
username = ​"dave"
 
password = ​"1234"
 
}
 
hibernate {
 
cache.use_second_level_cache = true
 
cache.use_query_cache = false
 
cache.region.factory_class =
 
'net.sf.ehcache.hibernate.EhCacheRegionFactory'​ ​// Hibernate 3
 
// cache.region.factory_class =
 
// 'org.hibernate.cache.ehcache.EhCacheRegionFactory' // Hibernate 4
 
}
 
 
// environment specific settings
 
environments {
 
development {
 
dataSource {
 
dbCreate = ​"update"​ ​ ...

Get Grails 2: A Quick-Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.