Search This Blog

Friday, March 11, 2011

Export data from Firebird into pure SQL inserts/ export data from Firebird to MySQL

When you need to export data from firebird into mySQL the easiest way is to use fbexport program. It’s manual is located here:

http://fbexport.sourceforge.net/manual.html


$> FBExport.exe -D "c:\DB\WL.FDB" -U user –P password -Si -V TEST -F test.out

Where:
Si – means “export to SQL inserts” format
V – table name to export
F – output filename

Be careful with dates in mysql. Export in the correct format. To export db in custom date format use:

$> FBExport.exe -D "c:\DB\WL.FDB" -U user –P password -Si -V TEST -F test.out -J "Y-M-D" -K "H:M:S"

Where:
J  - date format
K – time format

 

To import date to mySQL use SOURCE command:

$> mysql --user=root --password=password

$> use  database_name

$> SOURCE  c:\export\table_name.out

 

SOURCE command imports the whole file (executes SQL statements in it)

5 comments:

  1. To narzędzie uratowało dzień :)

    ReplyDelete
  2. Thanks, very useful !

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. you used the windows to run these commands? because you use FBExport.exe and the site has only download option for linux.

    ReplyDelete
  5. Witam,
    Mam takie pytanie, w jaki sposób (z jakim parametrem) wyprowadzić selecta do pliku csv bez "".
    Przykład:
    jest tak: "1","2","3",...
    a chciałbym tak: 1,2,3,...

    ReplyDelete

If you like this post, please leave a comment :)