SQL SERVER 2005 - Backup/Restore database .

G

Gab

Hello !



I'am trying from winform application to backup and restore an SQL Server
2005 Database .

But each time , i try my Backup Methode ,I've got this following exception



Microsoft.SqlServer.Management.Smo.FailedOperationException was unhandled

Message="fail to connect the server « 192.168.7.100\X3 ».



My server is « 192.168.7.100\X3 »

My database Name is " caisseDB "





This is my backup() Methode :

public void BackUpNode()

{



string publicationServer= "192.168.7.100\X3";

string publicationDbName ="caisseDB";



ServerConnection conn = new ServerConnection(publicationServer);

Server server = new Server(conn);

Backup bkup = new Backup();

bkup.Database = publicationDbName;

bkup.Action = BackupActionType.Database;

bkup.BackupSetDescription = "Full backup of TEST";

bkup.BackupSetName = "TEST Backup";

BackupDeviceItem bdi = new BackupDeviceItem("c:\test\appCaisseDB.bak",
DeviceType.File);



bkup.Devices.Add(bdi);

// Full backup

bkup.Incremental = false;

bkup.ExpirationDate = DateTime.Now;

bkup.LogTruncation = BackupTruncateLogType.Truncate;



bkup.SqlBackup(server);

}



Thanks for your help !



Gabriel
 
A

Alberto Poblacion

Gab said:
[...]
Microsoft.SqlServer.Management.Smo.FailedOperationException was unhandled
Message="fail to connect the server « 192.168.7.100\X3 ».
[...]
ServerConnection conn = new ServerConnection(publicationServer);
[...]

Could it be a credentials problem? You are not providing any credentials
for your connection, so it will try to use integrated authentication. Is the
current user that is executing your code recognised at the server and mapped
to a Sql Server login?
 
G

Gab

Ok ! Thanks for your help .

Alberto Poblacion said:
Gab said:
[...]
Microsoft.SqlServer.Management.Smo.FailedOperationException was unhandled
Message="fail to connect the server « 192.168.7.100\X3 ».
[...]
ServerConnection conn = new ServerConnection(publicationServer);
[...]

Could it be a credentials problem? You are not providing any
credentials for your connection, so it will try to use integrated
authentication. Is the current user that is executing your code recognised
at the server and mapped to a Sql Server login?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top