tags:

views:

146

answers:

2

How to configure Grails to work with Apache Derby instead of HSQLDB

A: 

You need to have Derby libraries, and configure your DataSources.groovy appropriately. Check out this blog post. It's old, but the instructions might still work.

Jean Barmash
I found it in google long time ago before I post my question, but no it doesn't work unfortunately!
tranced_UT3
+1  A: 
  1. Install the derby driver into the lib folder of your application.
  2. Configure the DataSource:

    driverClassName = "org.apache.derby.jdbc.ClientDriver"
    dbCreate = "create-drop"
    url = "jdbc:derby://localhost:1527/theDatabase"

  3. Start the derby server.

  4. Create the empty database (through ij or a graphical sql client).
  5. Start grails.
Blacktiger
Good answer! Additionally: if you want to use embedded Derby rather than client-server Derby, change the class name to o.a.d.jdbc.EmbeddedDriver, and then you don't need to start the separate Derby server. You can also cause Derby to create the empty database automatically by adding ";create=true" to the connection URL. If you use the client driver, you'll need derbyclient.jar in your classpath; if you use the embedded driver, you'll need derby.jar in your classpath.
Bryan Pendleton