Wednesday, March 28, 2012

Problem in doing a backup of database on SQL server through Java code using jdbc

Problem in doing a backup of database on SQL server through Java code
using jdbc
Statement callBackupDbase = con.createStatement();
String dbackup = "BACKUP DATABASE databaseName TO DISK = 'Path for the
backup file";
if(callBackupDbase != null){
callBackupDbase.execute(dbackup);
}
I get the following error
[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Cannot perform a
backup or restore operation within a transaction.
Could anyone help me with that
BhagatI suggest you ask this in a jdbc group. The problem is that your code opens a transaction and then
try to execute the backup command. See the error message. You need to make the jdbc API not open a
transaction for you. How you do that, I don't know, it would be a jdbc issue, Perhaps in the
connection string, perhaps by using some other function calls in jdbc.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"bhagat" <bhagats_bhagat@.yahoo.com> wrote in message
news:1128354135.243884.15270@.g49g2000cwa.googlegroups.com...
> Problem in doing a backup of database on SQL server through Java code
> using jdbc
> Statement callBackupDbase = con.createStatement();
> String dbackup = "BACKUP DATABASE databaseName TO DISK = 'Path for the
> backup file";
> if(callBackupDbase != null){
> callBackupDbase.execute(dbackup);
> }
> I get the following error
> [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Cannot perform a
> backup or restore operation within a transaction.
> Could anyone help me with that
> Bhagat
>|||Thanks Mr Tibor Karaszi,
I shall try in the JDBC group

No comments:

Post a Comment