IBSurgeon library

How to execute SQL command with isql in command prompt

If you need to access Firebird database inside the batch/command line/PowerShell/bash script, the following technique will be useful:

Code
echo select count(*) from rdb$database; | c:\path\to\isql.exe host/port:alias -user sysdba -pass masterkey

In this case, isql.exe will be started, and the command between echo and | will be passed as input.

For example:

Code
echo select count(*) from rdb$types; | isql.exe localhost/3050:employee -user sysdba -pas masterkey

Example output:

Code
Database: localhost/3050:employee, User: SYSDBA
SQL>
                COUNT
=====================
                  254
SQL>