Domanda

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?

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top