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
Code
Has anybody ever wondered if there is an Open Anyhow, in this article I will describe the First let me tell you about the benefits of For starters you need to get the server and href="http://www.borland.com/devsupport/interbase/opensource/">http://www.borland.com/devsupport/interbase/opensource/ or get it a modified version (Firebird) from: Download and install the server and client I opted for the IBProvider from http://www.lcpi.lipetsk.ru/prog/eng/index.html Once you have downloaded and installed all Lets establish a connection to the database. Dim adoConn.Openstyle='font-family:Arial'> Ok, here are a few things to consider: Once the connection is open, we can start working For the most part, working with Interbase is For one, Interbase uses dialects, basically The other issue that I have found is: you cannot Ok, so how would we get some data in and out Here is a sample of a simple select statement: Dim rst.ActiveConnection And here is a simple stored procedure execution: Dim adoConn.Open With cmd adoConn.BeginTrans Notice that if your stored procedure returns Also, the way you pass parameters in and out With adoConn.BeginTrans Anyhow, these are the basics. If you guys are RafInterbase
ADO Tutorial
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)
issues and the necessary tools to get you up and running with Interbase.
Interbase:
are available)
writers and vice versa)
fields)
fields)
client software. You can get the original Open Source version (Source and Binaries)
from Borland at:
http://www.ibphoenix.com/ibp_download.html
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:
http://www.interbase2000.org/tools_conn.htm
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="http://www.oledb.net/?Page=FAQ">http://www.oledb.net/?Page=FAQ. However,
all my sample code is tested with IBProvider only.
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
basics:Connecting
to Interbase
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"
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.
with the database.Working
with an Interbase database
as easy as working with SQL Server or Access. However there are a few things
to consider:
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,
ADDRESS FROM TBLCUSTOMERS.
use adCmdStoredProc as your command type. Workaround for this: use adCmdText.
But more on this later.
of our database? Well, you can use your normal recordset object to execute a
SQL statement or you can use stored procedures.
rst As New Recordset
rst.Source = "SELECT CUSTOMER.CONTACT_FIRST, " &
_
"CUSTOMER.CONTACT_LAST, CUSTOMER.COUNTRY "
& _
"FROM CUSTOMER"
= adoConn
adoConn.BeginTrans
rst.Open
adoConn.CommitTrans
rst As New Recordset
Dim cmd As New ADODB.Command
.ActiveConnection = adoConn
.CommandText = "Select * FROM DEPT_BUDGET (100)"
End With
Set rst = cmd.Execute
adoConn.CommitTrans
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’.
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:
cmd
.ActiveConnection = adoConn
.CommandText = " execute procedure PROC_INSERT_TBLCUSTOMERS
(?,?,?)”
End With
cmd(0) = parameter value
cmd(1) = parameter value
cmd(2) = parameter value
cmd.Execute
adoConn.CommitTrans
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
Borland.
About this post
Posted: 2002-06-01
By: ArchiveBot
Viewed: 80 times
Categories
Attachments
Interbase_4273812172001.zip
Posted: 9/3/2020 3:45:00 PM
Size: 7,516 bytes
Loading Comments ...
Comments
No comments have been added for this post.
You must be logged in to make a comment.