You don't show your full DataSource.groovy
file, but it probably has the H2 driver in the top section (driverClassName = "org.h2.Driver"
). The values there are the defaults, and the environment-specific blocks are merged into that to create the final settings. You can override that in the production
block
production {
datasource {
dbCreate = "create-drop"
url = "jdbc:mysql://us-cdbr-east-05.cleardb.net/heroku_5a952ab6aXXXXXXX?reconnect=true"
username = "XXXXX"
password = "xxxxx"
driverClassName = 'com.mysql.jdbc.Driver'
dialect = org.hibernate.dialect.MySQL5InnoDBDialect
}
}
Additionally, you should always specify the dialect when using MySQL. Grails auto-detects the dialect well in most cases, but can't determine if you're using MyISAM or InnoDB, so it defaults to a dialect that uses the default engine type configured for the whole server. Newer versions of MySQL default to InnoDB and it's easy to change it in any version, but if you don't or it's an older version you'll end up with non-transactional MyISAM tables. Specifying the dialect ensures that your app uses the proper table type.