Search Tools Links Login

Interbase and ADO (open source DB for Windows)

This tutorial will give you a crash cource in working with Interbase (A free, open source databese from Borland) and ADO. It will show you where to get the database engine and teach you some simple basics.

Original Author: BDCSoftware


Interbase ADO Tutorial

ADO Tutorial

Has anybody ever wondered if there is an Open
Source alternative to SQL Server or Access databases? Well, I have, and I found
Interbase. Interbase is a Client/Server database from Borland. It is Open Source.
It runs on Windows, Linux and bunch of other *nix platforms. It has a very small
memory footprint and it is relatively fast. It will also support large database
files (larger the 2 gig. I know a guy that has a 300 Gig database up and running)

Anyhow, in this article I will describe the
issues and the necessary tools to get you up and running with Interbase.

First let me tell you about the benefits of

  1.   style='font-family:Arial'>Open Source

  2.   style='font-family:Arial'>Fast

  3.   style='font-family:Arial'>Small size

  4.   style='font-family:Arial'>Very easy distribution (scripts for Wise or InstallShield
    are available)

  5.   style='font-family:Arial'>Works ADO

  6.   style='font-family:Arial'>Works with ODBC

  7.   style='font-family:Arial'>Awesome transaction management (readers never block
    writers and vice versa)

  8.   style='font-family:Arial'>Multiple platform support (Linux/Unix)

  9.   style='font-family:Arial'>Superb support for BOLB fields (Images and memo

  10.   style='font-family:Arial'>Support for Arrays (you can store Arrays in individual

For starters you need to get the server and
client software. You can get the original Open Source version (Source and Binaries)
from Borland at:


or get it a modified version (Firebird) from:

Download and install the server and client
binaries. The Interbase server ships with a ODBC driver, but I hate ODBC and
use ADO/OleDB on a day to day basis. So I had to find an OleDB driver for Interbase.
Luckily there are numerous available. You can find a links to download sites
on this site:

I opted for the IBProvider from
because they had some VB samples of how to use the provider with ADO. The version
that you can download is an Evaluation for 30 days. If you want a completely
free OleDB provider then use: href=""> However,
all my sample code is tested with IBProvider only.

Once you have downloaded and installed all
the files, you are ready for development. IB (Interbase) ships with a sample
database called employee.gdb. We will use this database as an example. (You
can find it in ‘C:Program FilesBorlandInterBaseexamplesDatabase’ , provided
you installed the server in the default location). Anyhow, lets start with the


to Interbase

Lets establish a connection to the database.
A sample connection:

adoConn As New ADODB.Connection

    adoConn.ConnectionString = "provider=LCPI.IBProvider;data
source=localhost:C:Interbase    DBsEmployee.gdb;ctype=win1251;user id=SYSDBA;password=masterkey"


Ok, here are a few things to consider:

Default user name and password (like SA in SQLServer) are SYSDBA and masterkey
(case sensitive). The ‘data source’ parameter has a following syntax: IP
Address:file location on the remote system
. If you installed the server
on your development machine then use localhost or your IP. If you installed
it on a remote machine then use the IP Address of the machine. The file location
is a bit weird. It is local to the server and you can’t use UNC paths.

Once the connection is open, we can start working
with the database.


with an Interbase database

For the most part, working with Interbase is
as easy as working with SQL Server or Access. However there are a few things
to consider:

For one, Interbase uses dialects, basically
it’s the SQL syntax that you issue your commands to the database. IB 6.0 can
use Dialect 1 (legacy) and Dialect 3. The sample databases are in written in
Dialect 1. If you decide to use Dialect 3 (as I have), you will notice some
weird behavior. If your database has lower case table and field names, you will
have to surround them with double quotes. For instance: Select “CompanyName”,
“Address” from “tblCustomers”.
Needless to say this will create havoc with
VB programmers
Jstyle='font-family:Arial'>. One workaround is to use caps for table and field
names. (Btw, don’t ask me why this is the way it is.) For Instance: SELECT COMPAN_YNAME,

The other issue that I have found is: you cannot
use adCmdStoredProc as your command type. Workaround for this: use adCmdText.
But more on this later.

Ok, so how would we get some data in and out
of our database? Well, you can use your normal recordset object to execute a
SQL statement or you can use stored procedures.

Here is a sample of a simple select statement:

rst As New Recordset


& _

                "FROM CUSTOMER"             

= adoConn




And here is a simple stored procedure execution:

rst As New Recordset

    Dim cmd As New ADODB.Command


    With cmd

        .ActiveConnection = adoConn

        .CommandText = "Select * FROM DEPT_BUDGET (100)"

    End With


        Set rst = cmd.Execute


Notice that if your stored procedure returns
any rows, you have to use the ‘SELECT * FROM stored procedure name’ syntax.
If your procedure does not return any records, you can use ‘EXECUTE stored
procedure name

Also, the way you pass parameters in and out
of the procedure is a bit peculiar. Lets say you have an insert stored procedure
that will accept 3 parameters. To pass those parameters you can use inline syntax:
For instance, ‘execute procedure PROC_INSERT_TBLCUSTOMERS (comma delimited
parameter values)
or you can use this syntax:


.ActiveConnection = adoConn

        .CommandText = " execute procedure PROC_INSERT_TBLCUSTOMERS

End With


        cmd(0) = parameter value

        cmd(1) = parameter value

        cmd(2) = parameter value



Anyhow, these are the basics. If you guys are
interested in Interbase, I will write a 2nd part of the tutorial
that will cover some advanced features like working with Images, Arrays, UDF
functions and tools for Interbase. For now take a look at the sample code for
this tutorial, and take a look at the sample databases that are provided by


About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 72 times


Visual Basic 6

Posted: 9/3/2020 3:45:00 PM
Size: 7,516 bytes

Loading Comments ...


No comments have been added for this post.

You must be logged in to make a comment.