Subject RE: [ib-support] Cloning a local database with IBX??
Author Pete Bray
i would suggest that you go with the backup/restore route. using the
services api you can start a backup running (which will be quite happy
running with other client connections). then you can restore it. all from
within your existing app whilst it can be performing its other tasks. (i
think that ibx comes with services api components but if not i have delphi 4
components i could send you)

alternatively you can keep an empty database file. and every time you want
to clone your database, copy this empty file (which is safe because there
are no attachments) and then pump your data using 2 database components
within your app. again this approach is safe with other client connections
because it is done within transactions (just remember to set generators in
the clone to the current values from the master). if you do decide to go
this route, i have some code chunks you can have which reads the list of
tables from the database, then constructs the sql statements to pump them
over.

Kind regards,
Pete

> -----Original Message-----
> From: Phil Scadden [mailto:p.scadden@...]
> Sent: 04 October 2002 05:27
> To: ib-support@yahoogroups.com
> Subject: [ib-support] Cloning a local database with IBX??
>
>
> 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
>
>
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>