views:

386

answers:

3

how to migrate Grail's HSQLDB embedded database(That contains my App's Data that I don't want to lose) into external one, such as MySQL or ApacheDerby?

+1  A: 

Because grails uses hibernate underneath, no migration is necessary. All you need to do is repoint your conf\DataSources.groovy to the new database, and next time you startup, it will create tables in the new DB.

See section 3.3 in this doc for more information on MySQL config.

Jean Barmash
How to save my data?
tranced_UT3
+2  A: 

If your data isn't important just let hibernate regenerate your schema, else try this: http://www.grails.org/plugin/liquibase

Raphael
But I do want to save the data!
tranced_UT3
I checked out LiquiBase features http://www.liquibase.org/swf/overview_long/LiquiBase%20TechTalk.html, I am curious is Apache DdlUtils similar to Liquibase?
tranced_UT3
@GrailsNewbie there's some functionality overlap but Liquibase has more features. Also there's dbmigrate plugin that is based on apache ddlutils.
Xymor
+1  A: 

The MySQL Migration Toolkit may be exactly what you need.

A little searching turned up this article that shows examples of what the GUI Tool looks like.

I haven't had to migrate data from a HSQLDB to any other DB, but if I had data that I didn't want to use in a HSQLDB then I'd definitely try this method.

  • You are going to want to backup the HSQLDB database that you want to save (I'm assuming you used a file DB rather than an in-memory one right?)
  • Change your DataSource to a MySQL datasource with the dbCreate set to update (or something non-destructive)
  • Run the Migration Toolkit and migrate your data

Otherwise you ought to be able to view the data in your DB by using another tool (DBVisualizer, RazorDB, or others) and they might be able to help you export the data.

Colin Harrington