Click here to Skip to main content
12,292,976 members (62,953 online)
Click here to Skip to main content
Add your own
alternative version


186 bookmarked

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
My open-source event calendar/scheduling AJAX controls:

DayPilot for JavaScript/HTML5/jQuery
DayPilot for ASP.NET
DayPilot for MVC
DayPilot for Java

You may also be interested in...

Comments and Discussions

QuestionDLL Not Found Pin
jet858-May-07 7:31
memberjet858-May-07 7:31 
AnswerRe: DLL Not Found Pin
tcdavis9-May-07 6:06
membertcdavis9-May-07 6:06 
GeneralRe: DLL Not Found Pin
jet8510-May-07 9:04
memberjet8510-May-07 9:04 
GeneralRe: DLL Not Found Pin
tcdavis10-May-07 9:14
membertcdavis10-May-07 9:14 
GeneralRe: DLL Not Found Pin
balazs_hideghety16-Jul-07 3:41
memberbalazs_hideghety16-Jul-07 3:41 
GeneralRe: DLL Not Found Pin
DaberElay31-Jan-09 10:55
memberDaberElay31-Jan-09 10:55 
Generalnot managed Pin
Andrew Shapira4-Feb-07 3:11
memberAndrew Shapira4-Feb-07 3:11 
QuestionChange the password? Pin
Ismok15-Jan-07 15:39
memberIsmok15-Jan-07 15:39 
AnswerRe: Change the password? Pin
Balazs Zoltan16-Jan-07 21:27
memberBalazs Zoltan16-Jan-07 21:27 
GeneralRe: Change the password? Pin
transoft8-Sep-09 9:02
membertransoft8-Sep-09 9:02 
GeneralRe: Change the password? Pin
Trinh Tuan4-Sep-10 16:30
memberTrinh Tuan4-Sep-10 16:30 
AnswerRe: Change the password? Pin
devvvy15-May-12 14:55
memberdevvvy15-May-12 14:55 
QuestionHelp Help Help Pin
LinXG28-Nov-06 14:06
memberLinXG28-Nov-06 14:06 
AnswerRe: Help Help Help Pin
ArgoDragon4-Dec-06 15:36
memberArgoDragon4-Dec-06 15:36 
Generaldemo source(embedded firebird) Pin
newgendb23-Nov-06 7:24
membernewgendb23-Nov-06 7:24 
GeneralRe: demo source(embedded firebird) Pin
Balazs Zoltan23-Nov-06 8:09
memberBalazs Zoltan23-Nov-06 8:09 
GeneralRe: demo source(embedded firebird) Pin
newgendb23-Nov-06 8:17
membernewgendb23-Nov-06 8:17 
GeneralRe: demo source(embedded firebird) Pin
Balazs Zoltan23-Nov-06 9:07
memberBalazs Zoltan23-Nov-06 9:07 
GeneralRe: demo source(embedded firebird) Pin
newgendb23-Nov-06 9:14
membernewgendb23-Nov-06 9:14 
GeneralRe: demo source(embedded firebird) Pin
Balazs Zoltan23-Nov-06 20:35
memberBalazs Zoltan23-Nov-06 20:35 
GeneralVery interesting Pin
WillemM25-Oct-06 21:16
memberWillemM25-Oct-06 21:16 
QuestionHelp Please Pin
tyleray10-Aug-06 5:06
membertyleray10-Aug-06 5:06 
AnswerRe: Help Please Pin
_CloudyOne_5-Jun-08 13:49
member_CloudyOne_5-Jun-08 13:49 
GeneralFireBird and ASP.NET Pin
HoyaSaxa933-Aug-06 15:07
memberHoyaSaxa933-Aug-06 15:07 
Generalsynchronizing between two databases Pin
Gilad Kapelushnik19-Apr-06 22:13
memberGilad Kapelushnik19-Apr-06 22:13 
GeneralRe: synchronizing between two databases Pin
_CloudyOne_5-Jun-08 13:58
member_CloudyOne_5-Jun-08 13:58 
QuestionDifference? Pin
S Douglas27-Mar-06 23:40
memberS Douglas27-Mar-06 23:40 
AnswerRe: Difference? Pin
Dan Letecky28-Mar-06 4:46
memberDan Letecky28-Mar-06 4:46 
GeneralRe: Difference? Pin
S Douglas28-Mar-06 4:59
memberS Douglas28-Mar-06 4:59 
QuestionCan I use it on Linux? Pin
Ashraf_s15-Mar-06 1:07
memberAshraf_s15-Mar-06 1:07 
AnswerRe: Can I use it on Linux? Pin
Dan Letecky16-Mar-06 23:00
memberDan Letecky16-Mar-06 23:00 
GeneralRe: Can I use it on Linux? Pin
Ashraf_s17-Mar-06 5:51
memberAshraf_s17-Mar-06 5:51 
Questionusing FireBirs From MFC Pin
razishamai21-Sep-05 21:49
memberrazishamai21-Sep-05 21:49 
AnswerRe: using FireBirs From MFC Pin
Greg Strauss23-Jan-06 5:53
memberGreg Strauss23-Jan-06 5:53 
GeneralEmbedded server is no security,even the firebird is not security. Pin
javasleepless7-Sep-05 18:08
memberjavasleepless7-Sep-05 18:08 
GeneralRe: Embedded server is no security,even the firebird is not security. Pin
Dan Letecky2-Nov-05 2:56
memberDan Letecky2-Nov-05 2:56 
GeneralcreateDB Pin
jinboh27-Aug-05 18:34
memberjinboh27-Aug-05 18:34 
GeneralRe: createDB Pin
smeets11627-Sep-05 3:17
membersmeets11627-Sep-05 3:17 
GeneralRe: createDB Pin
alsan wong5-Apr-06 11:29
memberalsan wong5-Apr-06 11:29 
GeneralRe: createDB Pin
psychohamster18-Jun-06 21:34
memberpsychohamster18-Jun-06 21:34 
GeneralRe: createDB Pin
danielye5-Jun-06 23:29
memberdanielye5-Jun-06 23:29 
GeneralReally cool! but... Pin
weinboerse4-Aug-05 20:16
memberweinboerse4-Aug-05 20:16 
GeneralRe: Really cool! but... Pin
Dan Letecky10-Aug-05 8:59
memberDan Letecky10-Aug-05 8:59 
GeneralRe: Really cool! but... Pin
weinboerse10-Aug-05 19:46
memberweinboerse10-Aug-05 19:46 
GeneralSwitching between embedded and server Pin
mikejonesperficient28-Jul-05 12:45
membermikejonesperficient28-Jul-05 12:45 
GeneralRe: Switching between embedded and server Pin
Dan Letecky28-Jul-05 20:41
memberDan Letecky28-Jul-05 20:41 
GeneralRe: Switching between embedded and server Pin
mikejonesperficient29-Jul-05 4:41
membermikejonesperficient29-Jul-05 4:41 
Generalstandalone does not work Pin
jinboh25-May-05 4:28
memberjinboh25-May-05 4:28 
GeneralRe: standalone does not work Pin
Dan Letecky27-May-05 0:25
memberDan Letecky27-May-05 0:25 
GeneralRe: standalone does not work Pin
jinboh27-May-05 2:34
memberjinboh27-May-05 2:34 

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.

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