MySQL is a popular choice of database for many developers. It’s open source, easy to install, stable, and very fast. However, MySQL comes with several storage engine and you need to decide which one to choose. The two most popular are:

  • MyISAM – this is the default storage engine for MySQL prior to version 5.5. I believe this is the fastest storage engine of all, but the drawside is it does not support transactions.
  • InnoDB – this is not as fast as MyISAM, but it support transactions. This is the most popular among Java/Grails developers.

Edit DataSource.property and specify the dialect property. To use MyISAM, your configuration will look like this:

dataSource {
    pooled = true
    driverClassName = "com.mysql.jdbc.Driver"
    dialect = 'org.hibernate.dialect.MySQL5Dialect'
}
...

To use InnoDB, your configuration should look like:

dataSource {
    pooled = true
    driverClassName = "com.mysql.jdbc.Driver"
    dialect = 'org.hibernate.dialect.MySQL5InnoDBDialect'
}
...

Simple, but very handy.

Comments

comments