Java Developer

Adding SQL logging to your Grails application

While ORM is great in simplifying our work with the database, it is still very useful to know SQL statements our application is throwing at the database. Specially when we are still developing the application.

Specifying MyISAM or InnoDB MySQL storage engine in Grails

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.

Using Tomcat JNDI datasource when deploying Grails production war

When developing a grails application, it is acceptable to hard code the database connection in DataSource.groovy. But when you want to create a war and deploy it on an application server, it is better to use JNDI. This is more flexible because you can change the connection property in the application server, instead of creating a new war.