Click here to Skip to main content
Click here to Skip to main content

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

Comments and Discussions

Questionconnection to an erp Pinmemberezekielokeyo18-Jul-12 20:08 
QuestionFor those of you who're interested to get it setup on 64 bit platform (plus create db/table/insert rows) [modified] Pinmemberdevvvy14-May-12 3:05 
Generalembedded firebird with and vs2008 Pinmembersaurabh.patil@hotmail.com19-May-10 23:12 
QuestionHow Maintain Firebird Embedded Connection Open!?!?! PinmemberRafael Fernandes Brasil25-Aug-09 5:07 
QuestionStill Supported? PinmemberJawz-X8-Sep-08 11:24 
I've been planing to implement this in to a small program that I'm writing (which I may release on CodeProject) but it appears that Embedded Firebird is not longer supported.

I found this:[^] which is different from the link given to the article.

In short, the project was donated to the Core Firebird project. I thought that this was great, it might mean tighter integration.

However after some more sifting around, it appears that the project has never been updated.

To the best of my ability I've been able to determine this embedded package supports Firebird 2.0.1 on .NET 2.0. But I was hoping to use Firebird 2.1 on .NET 3.5.

But quite simply does anyone know one way or another if this project is still supported?

Thank you,
AnswerRe: Still Supported? PinmemberDr.Serdar12-Sep-08 13:35 
GeneralRe: Still Supported? PinmemberJawz-X16-Sep-08 9:22 
Generaldoesn't work for firebird 2 Pinmemberujal17-Aug-08 22:10 
QuestionProblems with Stored Procedures with Embedded Firebird 2.0 Pinmemberkiweed17-Jan-08 8:13 
QuestionHelp PinmemberK_Farhod17-Sep-07 23:46 
AnswerRe: Help Pinmember_CloudyOne_5-Jun-08 15:01 
QuestionDLL Not Found Pinmemberjet858-May-07 8:31 
AnswerRe: DLL Not Found Pinmembertcdavis9-May-07 7:06 
GeneralRe: DLL Not Found Pinmemberjet8510-May-07 10:04 
GeneralRe: DLL Not Found Pinmembertcdavis10-May-07 10:14 
GeneralRe: DLL Not Found Pinmemberbalazs_hideghety16-Jul-07 4:41 
GeneralRe: DLL Not Found PinmemberDaberElay31-Jan-09 11:55 
Generalnot managed PinmemberAndrew Shapira4-Feb-07 4:11 
QuestionChange the password? PinmemberIsmok15-Jan-07 16:39 
AnswerRe: Change the password? PinmemberBalazs Zoltan16-Jan-07 22:27 
GeneralRe: Change the password? Pinmembertransoft8-Sep-09 10:02 
GeneralRe: Change the password? PinmemberTrinh Tuan4-Sep-10 17:30 
AnswerRe: Change the password? [modified] Pinmemberdevvvy15-May-12 15:55 
QuestionHelp Help Help PinmemberLinXG28-Nov-06 15:06 
AnswerRe: Help Help Help PinmemberArgoDragon4-Dec-06 16:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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.150414.1 | Last Updated 28 Jan 2005
Article Copyright 2005 by Dan Letecky
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid