Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 21st, 2007, 06:06 PM
isz isz is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2007
Posts: 2 isz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 m 42 sec
Reputation Power: 0
Using gbak or FBBackup doesn't work?

Hi all...

We have an c# .net forms application that we are trying to provide firebird 2.0.1 embedded database backup functionality built in. Under the covers, we have tried using a gbak by using the following code:

Code:
                             
System.Diagnostics.Process proc = new System.Diagnostics.Process();

               if (System.IO.File.Exists("gbak.exe"))
               {
                  string args = string.Format("-v -t -user {0} -password {1} \"{2}\" \"{3}\"",
                     DB_USER,
                     DB_PASSWORD,
                     source,
                     destination);

                  proc.StartInfo.FileName = "gbak.exe";
                  proc.StartInfo.UseShellExecute = false;
                  proc.StartInfo.Arguments = args;
                  proc.StartInfo.RedirectStandardError = true;
                  proc.StartInfo.RedirectStandardOutput = true;

                  try
                  {
                     proc.Start();
                     proc.WaitForExit();
                     string foo = proc.StandardOutput.ReadToEnd();
                     string bar = proc.StandardError.ReadToEnd();
                     Console.WriteLine(foo);
                     Console.WriteLine(bar);
                     Console.WriteLine(args);
                     Console.ReadLine();
                  }
                  catch (Exception ex)
                  {
                     Console.WriteLine(ex.ToString());
                  }
               }


but we are seeing that the database is locked and we get the error:


gbak: ERROR:I/O error for file "C:\DEV\HOSTSIDE\DOTNET\PLUSIDMANAGER\PRIVARIS.PLUSIDMANAGER\BIN\RELEASE\PLUSID.FDB"
gbak: ERROR: Error while trying to open file
gbak: ERROR: The process cannot access the file because it is being used by another process.

The lock is being held by our own application. We have also tried doing the same with...

Code:
               FbConnectionStringBuilder cs = new FbConnectionStringBuilder();

               cs.UserID = "SYSDBA";
               cs.Password = "masterkey";
               cs.Database = source;

               FbBackup backupSvc = new FbBackup();

               backupSvc.ConnectionString = cs.ToString();
               backupSvc.BackupFiles.Add(new FbBackupFile(destination, 2048));
               backupSvc.Verbose = true;
               backupSvc.Options = FbBackupFlags.IgnoreLimbo | FbBackupFlags.NoGarbageCollect;

               backupSvc.ServiceOutput += new ServiceOutputEventHandler(backupSvc_ServiceOutput);

               try
               {
                  backupSvc.Execute();
               }
               catch (Exception ex)
               {
                  Console.WriteLine(ex.ToString());
               }


This fails for the same reason as using the gbak method. Here are some questions I have:

1. Since embedded mode creates 'an exclusive lock' is it then true that we would not be able to create backups with gbak while the database is running?

2. Will creating backups be possible with super server mode while the app is running?

3. What other options might we have to backup the embedded database while the app is running?


Thanks!

Isz

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > Using gbak or FBBackup doesn't work?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT