before performing an embedded database update, i want to perform a backup of
the data first, then verify the backup is ok. to do this i am trying to
perform a backup then a restore.

Q1. when i attempt an FbRestore immediately after an FbBackup, I am getting
an error saying the .fbk vackup file cannot be opened. yet if I put a
thread.Sleep() in there it is working. i haver tried to clear the connection
pools but this has not fixed. can anyone tell me what i am doing wrong?

Q2. if i want to verify that a backup is ok, then is the best way for me to
attempt an FbBackup operation within a Try/Catch statement. Or is this too
simplistic?

here is my code so far. thanks:

            // backup the database.
            try
            {
                FbBackup fbBackup = new FbBackup();
                fbBackup.ConnectionString = connectionString;
                fbBackup.BackupFiles.Add(fbBackupFile);
                fbBackup.Execute();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Backup failed. " + ex.Message);
            }

            FbConnection.ClearAllPools();
            //System.Threading.Thread.Sleep(new TimeSpan(0, 0 , 5));

            // validate the backup.
            fbConnectionStringBuilder.Database = "test2.fdb";
            connectionString = fbConnectionStringBuilder.ToString();
            try
            {
                FbRestore fbRestore = new FbRestore();
                fbRestore.ConnectionString = connectionString;
                fbRestore.BackupFiles.Add(fbBackupFile);
                fbRestore.PageSize = 4096;
                fbRestore.Options = FbRestoreFlags.Create |
FbRestoreFlags.Replace;
                fbRestore.Execute();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Restore failed. " + ex.Message);
            }
-- 
View this message in context: 
http://www.nabble.com/re-Backup-Restore-tf1917137.html#a5248307
Sent from the firebird-net-provider forum at Nabble.com.



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to