Search code examples
firebirdfirebird2.5isql

Run multiple insert queries against firebird database using isql


I have requirement of inserting enormous data in table of firebird database around 40K entries. I got my scripts ready but while executing it using flameRobin, the UI just got hang forever while inserting such enormous data in one go.

I know it would be fine if i execute my insert queries in blocks of 255 queries but i want to know if there is any bulk insert tool available for Firebird to do such entries while reading from my scripts.sql file.

After some googling, I came across isql tool but not able to execute the scripts against it. Can someone guide me to any other tool or the proper documentation to enter such enormous data in one go?

I have firebird version 2.5 installed on my system.


Solution

  • 40K doesn't seem a big number for me. In our cases we work with millions of records without significant problems. I think the reason of hunging is Flamerobin trying to parse whole script or something like this. Use isql utility instead. First, prepare a text file with commands:

    CONNECT "your_server:your_database_name" USER "sysdba" PASSWORD "masterkey";
    INSERT ... ;
    INSERT ... ;
    ....
    INSERT ... ;
    EXIT;
    

    Then run an utility from a dos prompt:

    isql < your_script.sql
    

    Also consider to deactivate indices and drop foreign keys for the table for a bulk insert operation and restore them afterwards.