Click here to Skip to main content
12,893,452 members (57,972 online)
Click here to Skip to main content
Add your own
alternative version


189 bookmarked
Posted 28 Jan 2005

Embedded Firebird: Full-Featured Embedded Database with 2 MB Runtime

, 28 Jan 2005
Rate this:
Please Sign up or sign in to vote.
An example that shows how Firebird database excels in embedding.

Sample Image - screenshot.gif

The advantages of Embedded Firebird

Firebird is a database with 20 years of history, full set of features (including transactions, stored procedures, hot-backup, excellent scalability, etc.) and a friendly open source license. It is an overlooked but compelling alternative to Microsoft Jet and Microsoft MSDE 2000/SQL Express 2005. Let's take a look at how it can be used embedded in your desktop application. What makes Embedded Firebird ideal for embedding:

  • The embedded runtime is < 2 MB (starting at just one DLL + one .NET assembly). The runtime is deployed by simple copying, no installation or component registration is required.
  • The database file (it's just a single file) can have any name and extension. You can associate the extension with your application.
  • The migration to a standalone server couldn't be easier. Just copy the database file to the server and change a connection string on your client.

Working with Embedded Firebird

To start using Embedded Firebird in .NET, you need to download:

  • Embedded Firebird Engine (current stable version is 1.5.2)
  • Firebird ADO.NET Provider (current stable version is 1.6.3)

After creating a new project in Visual Studio .NET, add a reference to FirebirdSql.Data.Firebird.dll (from Firebird ADO.NET Provider installation), and copy fbembed.dll (from Embedded Firebird ZIP package) to the project output directory (e.g., bin/Debug).

The Firebird ADO.NET Provider can connect to a standalone Firebird Server using a connection string like this:

FbConnection c = new FbConnection("ServerType=0;User=SYSDBA;" + 

It can connect to an embedded Firebird using this connection string:

FbConnection c = new FbConnection("ServerType=1;User=SYSDBA;" + 

The database path can be relative to fbembed.dll when using the Embedded Firebird.

You see that switching from embedded and standalone Firebird and vice versa is a piece of cake.

Creating a new database

There are two ways to create a new database:

  • Creating a database programmatically.
  • Copying an existing database template.

It's up to you which way you choose. Copying an existing database is easy (just make sure the template is not open before copying), so let's try to create it programmatically.

Hashtable parameters = new Hashtable();
parameters.Add("User", "SYSDBA");
parameters.Add("Password", "masterkey");
parameters.Add("Database", @"mydb.fdb");
parameters.Add("ServerType", 1);

Continue as usual

Working with Firebird ADO.NET Provider is easy. You will reuse your experience with other ADO.NET providers. It even has some nice features, like calling the stored procedures using the MSSQL style:

FbCommand cmd = new FbCommand("MYSTOREDPROCEDURE", 
            new FbConnection(connectionString));
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@first", "value1");
cmd.Parameters.Add("@second", "value2");

Useful Resources


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Dan Letecky
Czech Republic Czech Republic

You may also be interested in...

Comments and Discussions

GeneralClass Generator Pin
Dmitry Ivanov1-Feb-05 10:17
memberDmitry Ivanov1-Feb-05 10:17 
GeneralRe: Class Generator Pin
Dan Letecky2-Feb-05 0:09
memberDan Letecky2-Feb-05 0:09 
GeneralRe: Class Generator Pin
NaumanLeghari2-Feb-05 3:43
memberNaumanLeghari2-Feb-05 3:43 
GeneralRe: Class Generator Pin
ariesT10-Feb-05 11:33
memberariesT10-Feb-05 11:33 
QuestionEmbed in ASP.Net app? Pin
Kev @ BN23.com30-Jan-05 23:31
sussKev @ BN23.com30-Jan-05 23:31 
AnswerRe: Embed in ASP.Net app? Pin
Dan Letecky31-Jan-05 4:24
memberDan Letecky31-Jan-05 4:24 
GeneralIncluding Dll as Content. Pin
Peter M. Lemmen29-Jan-05 13:04
memberPeter M. Lemmen29-Jan-05 13:04 
Questionmono? Pin
samirkut29-Jan-05 5:31
membersamirkut29-Jan-05 5:31 
have you tried using this in mono. does it work? I am guessing that it'll probably work on windows but might fail on linux.

AnswerRe: mono? Pin
Dan Letecky29-Jan-05 8:15
memberDan Letecky29-Jan-05 8:15 
GeneralUnable to load DLL (fbembed) Pin
Todd Davis29-Jan-05 1:47
memberTodd Davis29-Jan-05 1:47 
GeneralRe: Unable to load DLL (fbembed) Pin
Dan Letecky29-Jan-05 8:20
memberDan Letecky29-Jan-05 8:20 
GeneralRe: Unable to load DLL (fbembed) Pin
Todd Davis29-Jan-05 9:12
memberTodd Davis29-Jan-05 9:12 
GeneralRe: Unable to load DLL (fbembed) Pin
Dan Letecky29-Jan-05 9:42
memberDan Letecky29-Jan-05 9:42 
GeneralRe: Unable to load DLL (fbembed) Pin
Todd Davis29-Jan-05 11:30
memberTodd Davis29-Jan-05 11:30 
GeneralRe: Unable to load DLL (fbembed) Pin
Anonymous15-Feb-05 7:52
sussAnonymous15-Feb-05 7:52 
GeneralOpen Source Pin
fvcs28-Jan-05 19:30
memberfvcs28-Jan-05 19:30 
GeneralRe: Open Source Pin
Dan Letecky28-Jan-05 20:55
memberDan Letecky28-Jan-05 20:55 
GeneralThanks Pin
Todd Davis28-Jan-05 15:21
memberTodd Davis28-Jan-05 15:21 
Questionwhere's the source code? Pin
Marc Clifton28-Jan-05 14:57
protectorMarc Clifton28-Jan-05 14:57 
AnswerRe: where's the source code? Pin
Dan Letecky28-Jan-05 20:35
memberDan Letecky28-Jan-05 20:35 
GeneralRe: where's the source code? Pin
Marc Clifton29-Jan-05 3:29
protectorMarc Clifton29-Jan-05 3:29 
GeneralRe: where's the source code? Pin
fvcs29-Jan-05 4:27
memberfvcs29-Jan-05 4:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170424.1 | Last Updated 28 Jan 2005
Article Copyright 2005 by Dan Letecky
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid