Tool for exporting and importing data with Firebird and InterBase databases
What does it do?
With FBExport, one can easily
export/import data from/to Firebird table into a text file (actually
it's a binary file). I first tought that XML format would be the way to
go, but size of exported file matters, so I used my own format which uses less
space. It can also export data in CSV format and as INSERT statements.
FBExport is a command-line tool, so you can easily use it inside batch scripts. Currently, Linux and Windows versions are available, but I hope it can be built with any compiler that can build IBPP library. For versions 1.40 to 1.60, the is also a GUI version of the tool available. GUI is not flexible enough to support the newest features in version 1.65, so 1.60 will probably be the last version with GUI variant.
FBExport is released as a single package containing source code, linux and windows command-line and GUI binaries. I decided to use .zip format since I wanted to put everything into a single file, and .zip seems to be most available on both platforms. You can use unzip program (from InfoZip package) on Linux to unpack it. The file is named: fbx160-full.zip. Please note that while this is the last version with GUI, newer CLI versions support more features. Please use the download link on the left to fetch the latest version.
Why use it?
I was trying to copy data from one
Firebird database to another
via external tables. The whole import/export process was needed since
there was no chance of getting access to both databases at the same
time, so any of those data-pump utilities was out of the question.
Thus, I came up with the idea to export data into text file, copy that
file to other server, and import the data into other database.
Then I had problem with NULLs. When exporting data into external tables, database engine turns all null values into zeroes (hex value 0). When importing back, integers become zero, dates become 17.11.1858, etc. I also tried to use CHAR for all exporting, but then, null value for integer becomes " ", or something similar, and one gets error message: Conversion error from string " ".
Instead of writing some UDFs or a lot of Stored Procedures for each table, I decided to make a tool that will do this job...
Also, Firebird has a heavy network protocol which works slow over the modem line, so it takes a lot of time to send data with some data-pump tool. With FBExport you can write a batch script to export the data at one end, zip it, and send over the wire. Then at the other side, unpack and import. Transfering one big .zip file is much faster than making database connections, transactions, filling parameter values, executing statements, commiting, etc.
Restrictions
This tool uses IBPP library for database access. It supports Firebird 1.0, 1.5, 2.0 and InterBase 6 databases. It should also work with InterBase 6.5 and 7, but noone has confirmed it yet. If it works for you, please let me know. As IBPP project grows, I hope to support all database engines they do.
FBExport doesn't support ARRAY datatype.
Licence
FBExport is Free Software, released under Mozilla Public licence, version 1.0
Download
This project is hosted on
Sourceforge. You can get the packages in the download area.