views:

39

answers:

1

I want to backup HSQLDB from grails, Here's the command BACKUP DATABASE TO 'C:/BACKUP/' BLOCKING But how to do this in GORM where all seems Entity related even executeQuery ?

Thank you for sharing your experience :)

+1  A: 

Here's one way that still uses groovy, but not GORM. Since it is not related to a specific object, I wouldn't be concerned that you aren't using GORM. You can of course also drop down into java jdbc directly.

def conn = new groovy.sql.Sql((java.sql.Connection) AH.application.mainContext.sessionFactory.currentSession.connection())

    try
    {
      conn.execute("YOUR SQL STATEMENT")
    }
    catch (Exception e)
    {
      System.out.println "Error " + e.toString()
      System.out.println proc
    }
    conn.close()
Andrew
Looks like you need to reformat the post a bit to get the first couple of lines into the code snippet (indent four spaces).
Matt Lachman