Why does grails use hsqldb when I ask for mysql?

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2010-03-24T12:53:22Z Indexed on 2010/03/24 13:03 UTC
Read the original article Hit count: 249

Filed under:
|

I'm following the racetrack example from Jason Rudolph's book at InfoQ, using grails-1.2.1. I got up to the part where I was to switch from hsqldb to mysql. I think I've deleted every reference to hsqldb in the DataSource.groovy file, but I get an exception and the stack trace shows it's still using hsqldb.

DataSource.groovy

dataSource {
    boolean pooled = true
    String driverClassName = "com.mysql.jdbc.Driver"
    String url = "jdbc:mysql://localhost/dfpc2"
    String dbCreate = "create"
    String username = "dfpc2"
    String password = "dfpc2"
    dialect = org.hibernate.dialect.MySQL5InnoDBDialect 
}
hibernate {
    cache.use_second_level_cache=true
    cache.use_query_cache=true
    cache.provider_class='net.sf.ehcache.hibernate.EhCacheProvider'
}
// environment specific settings
environments {
    development {
    }
    test {
    }
    production {
    }
}

When I grails run-app it all starts up with no errors. I can navigate to the home page. But when I click on one of the links, I get a stack trace:

java.sql.SQLException: Table not found in statement [select this_.id as id0_0_, this_.version as version0_0_, this_.name as name0_0_, this_.variant as variant0_0_ from domainObject this_ limit ?]
at org.hsqldb.jdbc.Util.throwError(Unknown Source)
at org.hsqldb.jdbc.jdbcPreparedStatement.<init>(Unknown Source)
at org.hsqldb.jdbc.jdbcConnection.prepareStatement(Unknown Source)
at dfpc2.domainObjectController$_closure2.doCall(script1269434425504953491149.groovy:13)
at dfpc2.domainObjectController$_closure2.doCall(script1269434425504953491149.groovy)
at java.lang.Thread.run(Thread.java:619)

My mysql database shows no tables created. (I don't think groovy's connected to mysql yet.)

Things I've checked:

  1. mysql-connector-java-5.1.6.jar is in lib directory.
  2. I've tried grails clean
  3. I tried putting the dataSource info in the development environment (I haven't graduated to test or prod yet), but it seemed to make no difference. The stdout shows I'm using development env.

I've googled for solutions, but the only solution I've found is when people don't change the test or production environments.

© Stack Overflow or respective owner

Related posts about grails

Related posts about datasource