Subject Cloning a local database with IBX??
Author Phil Scadden
I am desparately trying to clone a database and not have a lot of luck.

What I want to do (from inside a program that is attached to local database)

create a copy of the local GDB file.
Open a connection to the local GDB file and execute an SQL to update an
admin table then close that connection.

Now I know straight copying a gdb is dangerous but figured if I closed every
connection, copied it, re-opened the connection, what could go wrong?

Well plenty. I am struggling to close the connection in IBX.
I commit any pending transactions, close the IBSQL that does the work, then
set IBDatabase.connected to false.

Copying the database at this stage fails because a copy process cant open
the GDB file fmsharedenywrite. Hmm

Try shutting Firebird, copyfile, restart firebird, open connection to cloned
database, update it, close connection and reopen to old. The clone is fine.
However, if my program now tries to do an operation on the old database (or
even if I just exit the program which just frees the connection), I get the
error:
Unable to complete network request to host "127.0.0.1".
Error reading data from the connection.
An established connection was aborted by the software in your host machine.

I'm lost. I guess a backup and restore to another file might help, but surely I
still have to successfully close all the connections before the backup.

Any help most appreciated.

Thanks

----------------------------------------------------------
Phil Scadden, Institute of Geological and Nuclear Sciences
41 Bell Rd South, PO Box 30368, Lower Hutt, New Zealand
Ph +64 4 5704821, fax +64 4 5704603