1

I got some dummy database (i use firebird) file, I fill it with some data and when filling procedure is finished I copy it and save with new name. Using code below, by the way:

void importdb_module::copyAndSaveDatabaseFile(){
    QString source_file = "c:/databases/dummy.fdb";
    QString destination_file =  QFileDialog::getSaveFileName(this, "Save", "c:/databases/", "*.fdb"); 
    QFile::copy(source_file, destination_file);

    deleteDummyContent();
}

It does what it suppose to do - creates copy of dummy.fdb file whit new name. But the problem is, when I try to open it with IBexpert I get such error message: enter image description here

Login and password which I used were defualt SYSDBA and masterkey - I do everything om my machine, in one environment. Also dummy.fdb file and it's copy sizes are same.

So why copy became coorupt? And how to copy .fdb files correctly then?

DanilGholtsman
  • 2,354
  • 4
  • 38
  • 69
  • Firebird authentication is at the server level and not in the databases themselves. Are you trying to open the copy on a machine where the SYSDBA password is different? – nater Nov 06 '13 at 17:29
  • @nater nope, I make all this on my machine, in same environment! I mean dummy.fdb creation and making copy – DanilGholtsman Nov 06 '13 at 18:07

1 Answers1

4

You have to make sure the db connection is closed before copying the file. Otherwise the file is not consistent. Better use the gbak backup utility from the firebird bin folder instead of making file copies.

  • oh, thanks! well, I actually need to copy files and save it with new names, it's like a creation of new database using dummy template – DanilGholtsman Nov 07 '13 at 03:21
  • 1
    @DanilGholtsman Even then, a (transportable) backup and restore is a far better plan than copying the file because 1) some parts of the database file are platform dependent (or could be, it has been reduced in the last few Firebird versions), 2) the restore will 'upgrade' the database to the latest ODS version for the Firebird server you are restoring to. – Mark Rotteveel Nov 07 '13 at 09:04