Recently, we already tried to work with the SQL Server 2012 LocalDB database. Now let’s try a more old-fashioned database, like Firebird Embedded. Again, we’ll modify the Sample Server application shipped with Data Abstract for .NET.

Let’s start with the FB Embedded installation.

Note:
In this article, I’ll use the PCTrade Firebird database, restored from the backup file

c:\Users\Public\Documents\RemObjects Samples\Data Abstract for .NET\Server\Scripts\PCTrade_FB.fbk

shipped with the Data Abstract for .NET samples.

Setup

Actually, there is no installation needed at all for FB Embedded. All you need is to download a file from http://sourceforge.net/projects/firebird/files/ (you’ll need to choose your platform and to download the file Firebird-…Win32_embed….zip). For example, the file containing Firebird 2.5.1 Embedded for Win 32 is named http://sourceforge.net/projects/firebird/files/firebird-win32/2.5.1-Release/Firebird-2.5.1.26351-0_Win32_embed.zip

This archive contains more than 2 dozen files, but we need only four of them at this moment – fbembed.dll, icudt30.dll, icuin30.dll and icuuc30.dll (don’t forget to check the README_embedded.txt file for more details on installation and files needed).

You need to copy this file next to the Schema Modeler’s .exe file to allow Schema Modeler to load the Firebird Embedded engine at runtime when needed.

Now let’s check if everything is done right.

Shut down the Firebird server if you have one running. Start the Schema Modeler and create a new connection (don’t forget to set the correct path to PCTrade.FDB):

[![Connection Wizard](http://blogs.remobjects.com/wp-content/uploads/2011/12/01.-FBEmbedded-Connection-Wizard.png "Connection Wizard")](http://blogs.remobjects.com/wp-content/uploads/2011/12/01.-FBEmbedded-Connection-Wizard.png)
If you now press the ‘Test Connection’ button, this test will fail (if it doesn’t fail, it means you still have the Firebird server running):
[![Connection Test failed](http://blogs.remobjects.com/wp-content/uploads/2011/12/02.-FBEmbedded-Connection-Test-Failed-Server-Is-Down.png "Connection Test failed")](http://blogs.remobjects.com/wp-content/uploads/2011/12/02.-FBEmbedded-Connection-Test-Failed-Server-Is-Down.png)
And now the most important part begins: Add the following text to the custom driver-dependent parameters:ServerType=1
[![Connection Wizard](http://blogs.remobjects.com/wp-content/uploads/2011/12/03.-FBEmbedded-Connection-Wizard-With-Proper-Settings.png "Connection Wizard")](http://blogs.remobjects.com/wp-content/uploads/2011/12/03.-FBEmbedded-Connection-Wizard-With-Proper-Settings.png)
Now press the ‘Test Connection’ button again. If you forgot to copy some files, you’ll see something like this:
[![Connection Test failed (due to missing DLL)](http://blogs.remobjects.com/wp-content/uploads/2011/12/04.-FBEmbedded-Connection-Test-Failed-DLL-Not-Found.png "Connection Test failed (due to missing DLL)")](http://blogs.remobjects.com/wp-content/uploads/2011/12/04.-FBEmbedded-Connection-Test-Failed-DLL-Not-Found.png)
But if everything was done right, you’ll see the much more pleasant message:
[![Connection Test succeeded](http://blogs.remobjects.com/wp-content/uploads/2011/12/05.-FBEmbedded-Connection-Test-Succeeded.png "Connection Test succeeded")](http://blogs.remobjects.com/wp-content/uploads/2011/12/05.-FBEmbedded-Connection-Test-Succeeded.png)
So the first part is done. We have deployed the needed files and successfully tested the Firebird Embedded connection. ## Sample Server

Now let’s modify a real application.
Open the “c:\Users\Public\Documents\RemObjects Samples\Data Abstract for .NET\Server\DASampleServer.Wpf.2010.sln” solution. Add the files fbembed.dll, icudt30.dll, icuin30.dll and icuuc30.dll via the ‘Add Existing Item’ dialog to the DASampleServer.Engine.2010 project. Double-check that all 4 newly added files have their Build Action property set to Content and their Copy to Output Directory property set to Copy Always.

Double-click the DASampleService.daSchema file and edit the PCTrade.FB connection:

[![Connection Wizard](http://blogs.remobjects.com/wp-content/uploads/2011/12/06.-FBEmbedded-Connection-Wizard-With-Proper-Settings.png "Connection Wizard")](http://blogs.remobjects.com/wp-content/uploads/2011/12/06.-FBEmbedded-Connection-Wizard-With-Proper-Settings.png)
You need to correct the path to the PCTrade.FDB database and add ‘ServerType=1’ to the connection’s custom properties.Now build and run the server.

Select the PCTrade.FB connection and… That’s it! The data was successfully retrieved from the FB Embedded database.

[![JavaScript Data Client](http://blogs.remobjects.com/wp-content/uploads/2011/12/09.-FBEmbedded-Data-Access.png "JavaScript Data Client")](http://blogs.remobjects.com/wp-content/uploads/2011/12/09.-FBEmbedded-Data-Access.png)
[![Sample Server](http://blogs.remobjects.com/wp-content/uploads/2011/12/10.-FBEmbedded-Sample-Server.png "Sample Server")](http://blogs.remobjects.com/wp-content/uploads/2011/12/10.-FBEmbedded-Sample-Server.png)
Note that Data Abstract for JavaScript was used to create the client app in pure HTML + JS.

x64 OS support

The Sample Server will crash if you use the x64 OS edition:

[![x64 Failure](http://blogs.remobjects.com/wp-content/uploads/2011/12/07.-FBEmbedded-x64-Failure-.png "x64 Failure")](http://blogs.remobjects.com/wp-content/uploads/2011/12/07.-FBEmbedded-x64-Failure-.png)
This happens because of an attempt to load x86 Firebird Embedded libraries into a .NET application build with the ‘Any CPU’ target platform. Such applications run in x64 mode on x64 OS and thus cannot load x86 libraries. The solution is either to provide x64 libraries or to set the x86 target platform in project’s properties:
[![VS Project Properties pane](http://blogs.remobjects.com/wp-content/uploads/2011/12/08.-FBEmbedded-DASampleServer.Wpf_.2010-Project-Properties.png "VS Project Properties pane")](http://blogs.remobjects.com/wp-content/uploads/2011/12/08.-FBEmbedded-DASampleServer.Wpf_.2010-Project-Properties.png)
## Conclusion

This article shows how to use Data Abstract for .NET and Firebird Embedded together (and that it’s no effort at all to do this). All you need is to deploy the needed dll’s and to remember about the x86/x64 compatibility caveat.