Wednesday, July 4, 2012
Importing and Exporting Data across Firebird Databases
In the past couple of weeks, I've encountered a few problems with the Firebird databases that I maintain. In both cases, I had to retrieve data from a backup and restore it to the one running in production.
Firebird does not come with any built-in utility to do that function. Thankfully, as with majority of open source projects, there are 3rd party solutions that seem to do what you want. In this case, I found FBExport:
The command-line syntax is very straightforward. First, you extract:
fbexport -S -H hostname -D database1.gdb -U username -P password -F file.fbx -Q "select * from sometable"
Then, you import:
fbexport -I -H hostname -D database2.gdb -U username -P password -F file.fbx -Q "INSERT INTO sometable(field1, field2, field3)"
It works great!