How to perform backup and restore operations using hibernate?
Iam using SQLServer 2005 database
I have tried it this way, but iam getting the following exception Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot perform a backup or restore operation within a transaction.
Query: String backupQuery="BACKUP DATABASE jiffy TO disk=?"; tx =session.beginTransaction();
SQLQuery selectQuery=session.createSQLQuery(backupQuery); selectQuery.setString(0, path); selectQuery.executeUpdate();
tx.commit();
I have did the same for Restore Iam getting the following exception Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: RESTORE cannot process database 'attendance' because it is in use by this session. It is recommended that the master database be used when performing this operation.
|