SQL SERVER 2005 - Backup/Restore database .

  • Thread starter Thread starter Gab
  • Start date Start date
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
 
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?
 
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?
 
Back
Top