Skip to main content
Email Password   helpLost your password?

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:

Working with Embedded Firebird

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

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;" + 
         "Password=masterkey;Dialect=3;Database=c:\\data\\mydb.fdb");

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

FbConnection c = new FbConnection("ServerType=1;User=SYSDBA;" + 
                 "Password=masterkey;Dialect=3;Database=mydb.fdb");

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:

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);
FbConnection.CreateDatabase(parameters);

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");
cmd.Connection.Open();
try
{
    cmd.ExecuteNonQuery();
}
finally
{
    cmd.Connection.Close();
}

Useful Resources

You must Sign In to use this message board.
 
 
Per page   
 FirstPrevNext
GeneralHow Maintain Firebird Embedded Connection Open!?!?! Pin
Rafael Fernandes Brasil
5:07 25 Aug '09  
QuestionStill Supported? Pin
Jawz-X
11:24 8 Sep '08  
AnswerRe: Still Supported? Pin
Dr.Serdar
13:35 12 Sep '08  
GeneralRe: Still Supported? Pin
Jawz-X
9:22 16 Sep '08  
Generaldoesn't work for firebird 2 Pin
ujal
22:10 17 Aug '08  
QuestionProblems with Stored Procedures with Embedded Firebird 2.0 Pin
kiweed
8:13 17 Jan '08  
QuestionHelp Pin
K_Farhod
23:46 17 Sep '07  
AnswerRe: Help Pin
_CloudyOne_
15:01 5 Jun '08  
QuestionDLL Not Found Pin
jet85
8:31 8 May '07  
AnswerRe: DLL Not Found Pin
tcdavis
7:06 9 May '07  
GeneralRe: DLL Not Found Pin
jet85
10:04 10 May '07  
GeneralRe: DLL Not Found Pin
tcdavis
10:14 10 May '07  
GeneralRe: DLL Not Found Pin
balazs_hideghety
4:41 16 Jul '07  
GeneralRe: DLL Not Found Pin
DaberElay
11:55 31 Jan '09  
Generalnot managed Pin
Andrew Shapira
4:11 4 Feb '07  
GeneralChange the password? Pin
Ismok
16:39 15 Jan '07  
GeneralRe: Change the password? Pin
Balazs Zoltan
22:27 16 Jan '07  
GeneralRe: Change the password? Pin
transoft
10:02 8 Sep '09  
QuestionHelp Help Help Pin
LinXG
15:06 28 Nov '06  
AnswerRe: Help Help Help Pin
ArgoDragon
16:36 4 Dec '06  
Generaldemo source(embedded firebird) Pin
newgendb
8:24 23 Nov '06  
GeneralRe: demo source(embedded firebird) Pin
Balazs Zoltan
9:09 23 Nov '06  
GeneralRe: demo source(embedded firebird) Pin
newgendb
9:17 23 Nov '06  
GeneralRe: demo source(embedded firebird) Pin
Balazs Zoltan
10:07 23 Nov '06  
GeneralRe: demo source(embedded firebird) Pin
newgendb
10:14 23 Nov '06  


Last Updated 28 Jan 2005 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2009