Skip to content

Instantly share code, notes, and snippets.

@winkler1
Created September 6, 2012 13:33
Show Gist options
  • Save winkler1/3656296 to your computer and use it in GitHub Desktop.
Save winkler1/3656296 to your computer and use it in GitHub Desktop.
Selectively using H2 database for Grails in Datasource.groovy
dataSource_DSName {
dbCreate = "update"
pooled = true
boolean useFastLocalH2DB = true
if ( useFastLocalH2DB ) {
assert grails.util.Environment == grails.util.Environment.DEVELOPMENT.current, 'Only use H2 DB in Development mode!'
driverClassName = "org.h2.Driver"
username = "sa"
password = ""
url = "jdbc:h2:file:DSName;LOCK_TIMEOUT=10000"
}
else {
url = 'jdbc:postgresql://192.168.1.1/DB'
username = 'user'
password = 'pass'
driverClassName = 'org.postgresql.Driver'
dialect = 'org.hibernate.dialect.PostgreSQLDialect'
properties {
maxActive = 10
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment