views:

31

answers:

1

For testing purposes, I'd like to have a console where I can just enter an HQL command and see what it returns on the grails hibernate DB (in my case a MySQL DB) while it's running e.g. in the test environment. What's the best way to do that?

I'm using Eclipse and already came across the JBoss Hibernate Tools, but I'm not sure how to configure them to use my grails MySQL DB. What Type (Core, Annotations, JPA) do I have to choose there and what to fill in the 'Configuration File' / 'Persistence unit' fields? I already set up a property file (see below).

hibernate.connection.username=sa  
hibernate.connection.password=
hibernate.connection.driver_class=org.hsqldb.jdbcDriver
hibernate.connection.url=jdbc:mysql://localhost/myproject
hibernate.connection.provider_class=org.hibernate.connection.DriverManagerConnectionProvider

But is this the best approach anyway?

A: 

I am not 100% sure if your close, but the Driver_class property is wrong for MySQL. Try

hibernate.connection.username=sa  
hibernate.connection.password=
hibernate.connection.driver_class=com.mysql.jdbc.Driver
hibernate.connection.url=jdbc:mysql://localhost/myproject
hibernate.connection.provider_class=org.hibernate.connection.DriverManagerConnectionProvider

The Class needs to be com.mysql.jdbc.Driver

Hope this helps

Scott Warren