Firebird database backup, restore

This is the code:

Imports FirebirdSql.Data.FirebirdClient
Imports FirebirdSql.Data.Services
Backup of a database: code

Dim n As FirebirdSql.Data.Services.FbBackup = New FirebirdSql.Data.Services.FbBackup()
Dim fl As FirebirdSql.Data.Services.FbBackupFile = New FirebirdSql.Data.Services.FbBackupFile(My.Application.Info.DirectoryPath & "\mydb.gdk", FileLen(My.Application.Info.DirectoryPath & "\mydb.gdb"))
n.BackupFiles.Add(fl)
n.ConnectionString = "servertype=0;username=sysdba;password=masterkey;database=" & My.Application.Info.DirectoryPath & "\mydb.gdb"
n.Execute()

Restore a database: code

  Dim cs As FbConnectionStringBuilder = New FbConnectionStringBuilder
        Dim restoreSvc As FbRestore = New FbRestore
        cs.ConnectionString = "servertype=1;username=sysdba;password=masterkey;database=" & My.Application.Info.DirectoryPath & "\Giorgio.gdb"
      
        restoreSvc.ConnectionString() = cs.ToString
        restoreSvc.BackupFiles.Add(New  _
        FbBackupFile(My.Application.Info.DirectoryPath & "\Giorgio.gdk", 2048))
        restoreSvc.Verbose = True
        restoreSvc.PageSize = 4096
        restoreSvc.PageBuffers = 2048
        restoreSvc.Options = FbRestoreFlags.Replace
        FbConnection.ClearAllPools()
        restoreSvc.Execute()

4 comments

  1. Where is the FileLen function?

    ReplyDelete
  2. Filelenght parameter is required by
    FbBackupFile method

    ReplyDelete
  3. Hi,

    I've visited your website and I was wondering if it
    would be possible to get a link to my partner's website on it?

    I'll place a link back to you in 2 of my SEO and web design websites,
    your link will be placed exactly here:

    http://planshabitatservices.com/ page rank 5
    http://www.acekingnogood.com/ page rank 1


    If you agree, then please link to me using these details:


    TITLE: server backup
    URL: http://www.onlineitbackup.co.uk/server-back
    DESCRIPTION: Online IT Backup provides backup services for your business. Protect your business

    documents with our online backup service


    Please don't forget to send me the title of your website after you
    place my link so I can do the same in less than 24 hours, otherwise you
    can delete my link from your site.

    I'll be waiitng for your kind reply

    Regards


    Megan Jones
    Online Marketing Consultant
    megan.jones@planshabitatservices.com

    ReplyDelete
  4. Hi megan,
    I don't like links exchange.
    Regards.

    ReplyDelete