atom feed7 messages in org.codehaus.grails.userRe: [grails-user] MySQL instead of HS...
FromSent OnAttachments
Arun GuptaApr 18, 2008 6:38 pm 
Guillaume LaforgeApr 18, 2008 6:42 pm 
Burt BeckwithApr 18, 2008 6:55 pm 
Arun GuptaApr 18, 2008 11:43 pm 
Fred JanonApr 19, 2008 12:08 am 
Burt BeckwithApr 19, 2008 7:39 am 
Burt BeckwithApr 19, 2008 7:41 am 
Subject:Re: [grails-user] MySQL instead of HSQLDB in WAR-based deployment
From:Burt Beckwith (bu@burtbeckwith.com)
Date:Apr 19, 2008 7:39:09 am
List:org.codehaus.grails.user

You're correct in general but I was talking specifically about MySQL. Dialect autodetection works fine most of the time, but with MySQL you'll end up with MySQLDialect.

This will create MyISAM tables unless your default table type is configured to be InnoDB in my.cnf. However if you specify the dialect to be MySQL5InnoDBDialect, you'll create InnoDB tables regarless of your my.cnf settings.

If you want MyISAM then this is fine, but you're giving up referential integrity and transaction support.

The runtime sql is the same, but the table generation DDL is different.

Burt

On Saturday 19 April 2008 3:09:12 am Fred Janon wrote:

Hi Arun,

Personally I don't specify a dialect if it can be avoided. That way I don't have to change too many lines in the config files if I want to try another database. The important thing also is that Hibernate will try to find out what dialect to use. In my experience, the dialect for mySQL is properly handled by Hibernate (or was in the version I deployed). I tried my project with and without specifying the dialect and looking at the SQL generated I didn't see any differences. If you enable SQL logging, you'll see what dialect Hibernate detects.

Fred

On Sat, Apr 19, 2008 at 2:43 PM, Arun Gupta <arun@gmail.com> wrote:

I think that's what it was, I fixed the configuration for production environment and then it worked!

Thanks for the dialect. What other dialects could be specified ?

Is "http://grails.org/doc/1.0.x/guide/3.%20Configuration.html#3.3 The DataSource" the only documentation for DataSource.groovy ?

-Arun

On Fri, Apr 18, 2008 at 6:56 PM, Burt Beckwith <bu@burtbeckwith.com>

wrote:

A deployed war runs by default in 'prod' mode, and that datasource

section is

pointing to HSQLDB ('jdbc:hsqldb:file:prodDb;shutdown=true').

Also, it's best to specify the dialect when using MySQL to ensure

you're using

transaction InnoDB tables instead of MyISAM tables - add this to your

config:

dialect = org.hibernate.dialect.MySQL5InnoDBDialect

Burt

On Friday 18 April 2008 9:39:12 pm Arun Gupta wrote:

I'm trying to deploy an app to use MySQL instead of HSQLDB and made the following changes to DataSource.groovy:

-- cut here -- dataSource { pooled = false driverClassName = "com.mysql.jdbc.Driver" username = "root" password = "" url = "jdbc:mysql://localhost/crud" } hibernate { cache.use_second_level_cache=true cache.use_query_cache=true cache.provider_class='org.hibernate.cache.EhCacheProvider' } // environment specific settings environments { development { dataSource { dbCreate = "create-drop" // one of 'create', 'create-drop','update' url = "jdbc:mysql://localhost/crud" } } test { dataSource { dbCreate = "update" url = "jdbc:hsqldb:mem:testDb" } } production { dataSource { dbCreate = "update" url = "jdbc:hsqldb:file:prodDb;shutdown=true" } } } -- cut here --

but seeing the following exception when the WAR is deployed:

-- cut here -- Caused by: org.springframework.jdbc.support.MetaDataAccessException: Could not get Connection for extracting meta data; nested exception

is

org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: User not found: ROOT ... 29 more Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: User not found: ROOT ... 29 more Caused by: java.sql.SQLException: User not found: ROOT at org.hsqldb.jdbc.Util.sqlException(Unknown Source) at org.hsqldb.jdbc.jdbcConnection.<init>(Unknown Source) at org.hsqldb.jdbcDriver.getConnection(Unknown Source) at org.hsqldb.jdbcDriver.connect(Unknown Source) at

java.sql.DriverManager.getConnection(DriverManager.java:525)

at

java.sql.DriverManager.getConnection(DriverManager.java:140)

... 29 more -- cut here --

It seems like the application is not recognizing MySQL database configuration. I saw some pointers on the alias and have followed the advice but can't get past this error.

I'm running MySQL on MacOS Leopard with --user root. MySQL

Connector/J

jar is bundled in the lib directory already.

Is there some other change required to trigger the change from HSQLDB

->

MySQL ?

--------------------------------------------------------------------- To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

-- Web Technologies and Standards Sun Microsystems, Inc. Blog: http://blogs.sun.com/arungupta

--------------------------------------------------------------------- To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

--------------------------------------------------------------------- To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email