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()
精彩评论