About the Easysoft ODBC-Firebird Driver

The Easysoft ODBC-Firebird Driver provides real-time access to Firebird data from any application that supports ODBC.

ODBC API and scalar functions

API functions

Use this table to find out what ODBC API functions the Easysoft ODBC-Firebird Driver supports:

Function Status

SQLAllocConnect

Supported

SQLAllocEnv

Supported

SQLAllocHandle

Supported

SQLAllocStmt

Supported

SQLBindCol

Supported

SQLBindParameter

Supported

SQLBrowseConnect

Not supported

SQLBulkOperations

Not supported

SQLCancel

Supported

SQLCloseCursor

Supported

SQLColAttribute

Supported

SQLColAttributes

Supported

SQLColumnPrivileges

Supported

SQLColumns

Supported

SQLConnect

Supported

SQLCopyDesc

Not supported

SQLDataSources

Supported

SQLDescribeCol

Supported

SQLDescribeParam

Supported

SQLDisconnect

Supported

SQLDriverConnect

Supported

SQLDrivers

Supported

SQLEndTran

Supported

SQLError

Supported

SQLExecDirect

Supported

SQLExecute

Supported

SQLExtendedFetch

Supported

SQLFetch

Supported

SQLFetchScroll

Supported

SQLForeignKeys

Supported

SQLFreeConnect

Supported

SQLFreeEnv

Supported

SQLFreeHandle

Supported

SQLFreeStmt

Supported

SQLGetConnectAtt

Supported

SQLGetConnectOption

Supported

SQLGetCursorName

Supported

SQLGetData

Supported

SQLGetDescField

Supported

SQLGetDescRec

Supported

SQLGetDiagField

Supported

SQLGetDiagRec

Supported

SQLGetEnvAttr

Supported

SQLGetFunctions

Supported

SQLGetInfo

Supported

SQLGetStmtAttr

Supported

SQLGetStmtOption

Supported

SQLGetTypeInfo

Supported

SQLMoreResults

Supported

SQLNativeSql

Supported

SQLNumParams

Supported

SQLNumResultCols

Supported

SQLParamData

Supported

SQLParamOptions

Supported

SQLPrepare

Supported

SQLPrimaryKeys

Supported

SQLProcedureColumns

Supported

SQLProcedures

Supported

SQLPutData

Supported

SQLRowCount

Supported

SQLSetConnectAttr

Supported

SQLSetConnectOption

Supported

SQLSetCursorName

Supported

SQLSetDescField

Supported

SQLSetDescRec

Supported

SQLSetEnvAttr

Supported

SQLSetParam

Supported

SQLSetPos

Not supported

SQLSetScrollOptions

Not supported

SQLSetStmtOption

Supported

SQLSetStmtOption

Supported

SQLSetStmtAttr

Supported

SQLStatistics

Supported

SQLTablePrivileges

Supported

SQLTables

Supported

SQLTransact

Supported

Data type mapping

The Easysoft ODBC-Firebird Driver maps Firebird data types to ODBC data types in this way:

Firebird data type ODBC data type

BLOB

SQL_LONGVARBINARY

BLOB SUB_TYPE TEXT

SQL_LONGVARCHAR

CHARACTER

SQL_CHAR

CHARACTER VARYING

SQL_VARCHAR

DATE

SQL_TYPE_DATE

DECIMAL

SQL_DECIMAL

DOUBLE PRECISION

SQL_DOUBLE

FLOAT

SQL_FLOAT

INTEGER

SQL_INTEGER

NATIONAL CHARACTER

SQL_WCHAR

NATIONAL CHARACTER VARYING

SQL_WVARCHAR

NUMERIC

SQL_NUMERIC

SMALLINT

SQL_SMALLINT

TIME

SQL_TYPE_TIME

TIMESTAMP

SQL_TYPE_TIMESTAMP

Finding out more about data types on Windows

If you need more information about a data types, for example, the precision and scale, use Microsoft’s ODBC Test to do this.

  1. Download the version of ODBC Test that matches your application’s architecture from:

  2. Copy both files to a folder on the machine where Easysoft ODBC-Firebird Driver is installed.

  3. Double-click odbcte32.exe.

  4. Select Con > Full Connect.

  5. Choose your Easysoft ODBC-Firebird Driver data source from the list.

  6. Choose Catalog > SQLGetTypeInfo.

  7. Either choose SQL_ALL_TYPES=0 (1.0) or a specific data type from the DataType list.

  8. Choose Results > Get Data All.

Cursor support

Cursor support in the Easysoft ODBC-Firebird Driver is restricted to FORWARD_ONLY, as this is the only cursor type supported by Firebird. As a result, the Easysoft ODBC-Firebird Driver works with ADO snapshots, but not with dynasets.

Multiple transactions on a single connection

Multiple transactions on a single connection aren’t supported in ODBC 3.x and therefore can’t be supported by the Easysoft ODBC-Firebird Driver.

Runtime SQL dialect support

Currently, the required SQL dialect can be set for a connection, but can’t be set at runtime, as it’s not a statement level property.

Rollback retaining

The Easysoft ODBC-Firebird Driver supports the isc_rollback_retaining function if it’s present in the Firebird client library.

SQL support

The Easysoft ODBC-Firebird Driver supports these SQL statements, clauses, and operators:

  • SELECT

  • SELECT DISTINCT

  • WHERE

  • ORDER BY

  • AND

  • OR

  • NOT

  • INSERT INTO

  • NULL

  • UPDATE

  • DELETE

  • FIRST

  • MIN

  • MAX

  • COUNT

  • SUM

  • AVG

  • LIKE

  • WILDCARDS

  • IN

  • BETWEEN

  • ALIASES

  • JOINS

  • UNION

  • GROUP BY

  • HAVING

  • EXISTS

  • CASE

Example queries

  • To fetch all records from a table, use the asterisk symbol (*) in your queries. For example:

    SELECT * FROM Customers
  • To only fetch records whose values are different, use DISTINCT. For example:

    -- Which different sales regions are there?
    SELECT DISTINCT Region AS Different_Regions FROM SalesOrders
    -- How many different sales regions are there?
    SELECT COUNT(DISTINCT Region) AS Different_Regions FROM SalesOrders
  • To filter records, use WHERE. For example:

    SELECT
      OrderDate,
      SalesRepresentative
    FROM
      SalesOrders
    WHERE
      Region = 'Eastern'
    
    SELECT
      OrderDate,
      SalesRepresentative
    FROM
      SalesOrders
    WHERE
      Region = 'Eastern'
      OR Region = 'Western'
    
    SELECT
      OrderDate,
      SalesRepresentative
    FROM
      SalesOrders
    WHERE
      Region = 'Eastern'
      AND EXTRACT (YEAR FROM OrderDate) = 2025

    You can also supply a WHERE clause value as a parameter. For example, to do this in Python:

    cursor.execute("SELECT
      OrderDate,
      SalesRepresentative
    FROM
      SalesOrders
    WHERE
      Region = ?", ['Eastern'])
  • To fetch records that don’t match the WHERE clause pattern use NOT. For example:

    SELECT
      OrderDate,
      SalesRepresentative
    FROM
      SalesOrders
    WHERE
      NOT Region = 'Eastern'
  • To sort the result set in either ascending or descending order, use ORDER BY. For example:

    SELECT
      *
    FROM
      SalesOrders
    ORDER BY
      OrderDate ASC
    
    SELECT
      *
    FROM
      Contacts
    ORDER BY
      (
        CASE
          WHEN Surname IS NULL THEN Title
          ELSE Surname
        END
      );
  • To group a result set into summary rows, use GROUP BY. For example:

    SELECT
        COUNT(Id) As "Number",
        ProductID
    FROM
        SalesOrderItems
    GROUP BY
        ProductID
    
    SELECT
        COUNT(Id) As "Number",
        ProductID
    FROM
        SalesOrderItems
    GROUP BY
        ProductID
    HAVING
      COUNT(Id) > 100;
  • To do calculations based on result set vales, use the SQL aggregate functions MIN(), MAX(), COUNT(), SUM(), and AVG(). For example:

    SELECT Max(Quantity) FROM SalesOrderItems
    SELECT Sum(Quantity) FROM SalesOrderItems
  • To convert between compatible data types, use CAST. For example:

    SELECT CAST(Quantity AS Char(100))FROM  SalesOrderItems
  • To fetch records that contain column values between a given range, use BETWEEN For example:

    SELECT ProductID FROM SalesOrderItems WHERE Quantity BETWEEN 10 AND 20
  • To combine the result set of two or more SELECT statements, use UNION. For example:

    SELECT City FROM Contacts
    UNION
    SELECT City FROM Customers
  • To combine rows from two or more tables, use JOIN. For example:

    SELECT SalesOrders.ID, Customers.Surname, SalesOrders.OrderDate
    FROM SalesOrders
    INNER JOIN Customers ON SalesOrders.CustomerID=Customers.ID;
  • To fetch records that contain column values matching a search pattern, use LIKE. For example:

    SELECT Surname, GivenName FROM Customers WHERE CompanyName LIKE 'R%'
    SELECT Surname, GivenName FROM Customers WHERE CompanyName LIKE '_he'
  • To search for columns without a value (NULL) or with a value (non NULL), use either IS NULL or IS NOT NULL. For example:

    SELECT * FROM Customers WHERE CompanyName IS NULL
  • To specify multiple values in a WHERE clause, you can use IN as an alternative to OR. For example:

    SELECT
      OrderDate,
      SalesRepresentative
    FROM
      SalesOrders
    WHERE
      Region = 'Eastern'
      OR Region = 'Western'
      OR Region = 'Central'

    can be replaced with:

    SELECT
      OrderDate,
      SalesRepresentative
    FROM
      SalesOrders
    WHERE
      Region IN  ('Eastern', 'Western', 'Central')
  • To set the maximum number of records to return, use FIRST. For example:

    SELECT FIRST 10 * FROM Customers
  • To test for the existence of records in a subquery, use EXISTS. For example:

    SELECT
      Name
    FROM
      Products
    WHERE
      EXISTS (
        SELECT
         *
        FROM
          SalesOrderItems
        WHERE
         Products.ID = SalesOrderItems.ProductID
          AND Quantity < 20
      )

Example inserts, updates, and deletes

  • To insert a Firebird record, use INSERT INTO. For example:

    INSERT INTO
        Customers (
            Surname,
            GivenName,
            City,
            Phone,
            CompanyName
        )
    VALUES
        (
            'Devlin',
            'Michaels',
            'Kingston',
            '2015558966',
            'PowerGroup'
        )
  • Here’s a SQL Server linked server example:

    EXEC ('INSERT INTO Customers (Surname, GivenName, City, Phone, CompanyName)
    VALUES (''Devlin'' , ''Michaels'' , ''Kingston'' , ''2015558966'' , ''PowerGroup'')')
  • Here’s an Oracle linked table example:

    DECLARE
      num_rows integer;
    BEGIN
    num_rows:=DBMS_HS_PASSTHROUGH.EXECUTE_IMMEDIATE@FirebirdLink
    ('INSERT INTO Customers (Surname, GivenName, City, Phone, CompanyName) VALUES (''Devlin'', ''Michaels'', ''Kingston'', ''2015558966'', ''PowerGroup'')');
    END;
    /
  • The Easysoft ODBC-Firebird Driver also supports parameterized inserts. Here’s an example of doing this in Perl:

    my $sth = $dbh->prepare(q/INSERT INTO Customers (Surname, GivenName, City, Phone, CompanyName) VALUES (?, ?, ?, ?, ?)/)
        or die "Can't prepare statement: $DBI::errstr";
    
    $sth->execute('Devlin', 'Michaels', 'Kingston', '2015558966', 'PowerGroup');
  • To update a Firebird record, use UPDATE. For example:

    UPDATE Customers
    SET
      Surname = 'Jones'
    WHERE
      Account_Id = 'PowerGroup'

    The Easysoft ODBC-Firebird Driver also supports parameterized updates. Here’s an example of doing this in Perl:

    my $sth = $dbh->prepare('UPDATE Customers SET Surname = \'Jones\' WHERE CompanyName = ?')
        or die "Can't prepare statement: $DBI::errstr";
    
    $sth->execute('PowerGroup');
  • To delete a Firebird record, use DELETE. For example:

    -- Delete (mark inactive) a bank account
    DELETE FROM Customers WHERE CompanyName = 'PowerGroup'

    The Easysoft ODBC-Firebird Driver also supports parameterized deletes. Here’s an example of doing this in Python:

    sql = "DELETE FROM Customers WHERE CompanyName = ?"
    cursor.execute(sql, 'PowerGroup')