开发者

How to execute BACKUP DATABASE query from grails?

I want to backup HSQLDB from grails, Here's the c开发者_开发百科ommand 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 :)


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()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜