Installing the Firebird .Net Data Provider into Visual Studio

I just spent a frustrating few hours trying to install the Firebird .Net Data Provider into Visual Studio. Installing the data access components itself is not terribly difficult but installing the GUI designer (DDEX) is another matter altogether.

I am only going to discuss the installation procedures for 32 bit systems here, since that is what I use and I have no way to verify the 64 bit installation instructions.

To install the data access components you need to download the Data Provider itself from http://www.firebirdsql.org/index.php?op=files&id=netprovider. Choose the version appropriate to your version of Visual Studio. At the time of writing that was 2.1.0 for Visual Studio 2005 and 2008, .Net 2.0. When the file is downloaded, double click it to start the Microsoft installer and install the component assemblies. If you accept the defaults, the DLLs will be installed to C:\Program Files\FirebirdClient 2.0.Since you are going to have to do this to make the design time GUI work, you might as well install the Data Provider assembly into the Global Assembly Cache (GAC) now. To do this, use gacutil as follows:


gacutil /i "C:\Program Files\FirebirdClient 2.0\FirebirdSql.Data.FirebirdClient.dll"

Note: When I tried to do this using Windows7 Beta I had to completely disable User Access Control. If I didn’t do this gacutil failed with an ‘Access Denied’ error.

Then list the information for this assembly using gacutil as follows:


gacutil /l FirebirdSql.Data.FirebirdClient

Make note of the Version, Culture and PublicKeyToken. You are going to need this information later.

Note: Be certain that you are using the version of gacutil that comes with .Net Framework 2.0. If you try to use the one for .Net 1.1 you will get strange errors when you try to install the assembly.

Now that the components have been installed, you need to make them available in the Visual Studio ToolBox. To do this, start Visual Studio, open a WinForm project and open the form designer. Open the ToolBox. Right click on the ToolBox and select Add Tab. You can give the tab any name you choose but Firebird is probably a good choice. Next, right click in the Firebird tab area and select Choose Items. When the Choose Toolbox Items dialog appears click the Browse button. Browse to C:\Program Files\FirebirdClient 2.0 and select FirebirdSql.Data.FirebirdClient.dll. Click Open. Click OK. The FbCommand, FbCommandBuilder, FbConnection and FbDataAdapter components should now appear in the Firebird area of the ToolBox.

To install the design time GUI you need to download the DDEX component from http://www.firebirdsql.org/index.php?op=files&id=netprovider. At the time of writing the web site showed the current version as 2.0.2 for Visual Studio 2005. The version which actually downloaded turned out the be 2.1.0 and it works equally well for Visual Studio 2005 and 2008.

When the file is downloaded double click it to start the installation and install the component’s files. If you accepted the defaults, the files will be installed to C:\Program Files\FirebirdClient.

You also need to install the Visual Studio SDK (not to be confused with the Framework SDK). This is available from the Microsoft Developer Network (MSDN) site. You must have Visual Studio Standard Edition or better to be able to install this SDK.  It will not work with Express editions.

Once you have the DDEX files installed there is a bit of manual work needed before Visual Studio will allow you to use them. First, you need to modify the FirebirdDDEXProvider.reg file, which is found in C:\Program Files\FirebirdClient. Use your favourite editor to find all occurrences of %Path% and replace them with C:\\Program Files\\FirebirdClient. Note the double backslashes. These are NOT a typo. If you are configuring for Visual Studio 2008 rather than 2005 you will also need to change all occurrences of the \8.0\ to \9.0\.  Save the file and double click it to import it into the registry.

Next you need to modify the .Net machine.config file. You can find this in C:\Windows\Microsoft.Net\Framework\V2.0.50727\CONFIG. You need to add the following line to the <configuration><configSections> section:


<section name="firebirdsql.data.firebirdclient" type="System.Data.Common.DbProviderConfigurationHandler, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

This line can be pasted directly into the file without modifications. Now you need to add the following line to the <system.data><DBProviderFactories> section:


<add name="FirebirdClient Data Provider" invariant="FirebirdSql.Data.FirebirdClient" description=".Net Framework Data Provider for Firebird" type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient, Version=%Version%, Culture=%Culture%, PublicKeyToken=%PublicKeyToken%" />

This line needs to be modified. Replace %Version% with the version of the FirebirdSql.Data.FirebirdClient assembly. (Remember, I told you that you were going to need the output from gacutil /l). Replace %Culture% with the culture of the assembly and replace %PublicKeyToken% with the public key token of the assembly.

Save the file.

If you have followed these instructions and haven’t made any typing mistakes in the .reg or machine.config files you should be able to start Visual Studio and use the GUI dataset designer to create your Firebird data sources.

Toubleshooting

If you don’t see the Firebird Data Provider as one of the options in the connection dialog you have probably messed up the registry. Check the FirebirdDDEXProvider.reg file for typing mistakes. Use regedit to make certain the the keys were created properly.

If you manage to request a Firebird connection and the Firebird Data Provider dialog appears but closes the minute you press a key, or if you can’t display the data source designer at all, then you have probably messed up the machine.config file. Check for typos, paying special attention to the version, culture and public key token values for the FirebirdSql.Data.Firebirdclient assembly. Also, make sure that the lines were added to the proper place in the file. Don’t do like I did and add the <add name=”Firebird … line AFTER the </DbProviderFactories> tag instead of in front of it.

18 Responses to “Installing the Firebird .Net Data Provider into Visual Studio”

  1. Dionísio Carvalho Says:

    Parabéns!
    Ótimo artigo. Igual à você perdi horas tentando fazer a conexão.
    Graças à você, consegui resolver o problema.
    Obrigado!

    (My english é bad, but i’ll try)
    Congratulations!
    Great article. Like you, “I just spent a frustrating few hours trying to install the Firebird .Net Data Provider into Visual Studio”. Thanks to you i have passed this problem.
    Thanks!

  2. Thierry Says:

    Thank you for the tutorial, I’m still having some issues after the installation.

    I did the step a couple of time (on different days) and always end with the same end result: “Error While Loading A Type”.

    I’m running Windows 7 Ultimate in 64 Bits, with Visual Studio 2008 Pro SP1 with the SDK installed, FireBird 2.1 in 32 Bits (Firebird-2.1.3.18185_0_Win32.exe) and the DDEX Provide 2.0.4 (FirebirdDDEXProvider-2.0.4.zip) I could not find an installer.

    http://yfrog.com/j919201030249pmp

    I can get the structures of the table, but I’m unable to make a simple query:

    http://yfrog.com/jd19201030628pmp

    Do you have any idea on what caused it?

  3. admin Says:

    Sounds like a typing mistake in the config file. If you did a cut and paste from my blog to the config file you might find that the quotation marks are incorrect. My blog software likes to use typographic quotes rather than a plain double quote.

  4. Rafael Says:

    Thank you so much!
    I looked all the web trying to find this, a guide to how to install and I couldn’t find until now.

    Thanks dude, really thanks, but just a note
    the quotes here are causing problems, I just found what was wrong when I read your comment

  5. Tobik Says:

    Don’t forget to install the NEWEST VS SDK, otherwise you’ll get error while trying to add a data source. I just spent an hour trying to find out what’s going on (VS 2008 SDK 1.0 needed SDK 1.1…)

  6. admin Says:

    I just found a new plugin that renders source code better within the blog pages. You should be able to copy & paste the XML statements from the blog to the configuration file now without having to worry about the quotation marks getting messed up.

  7. Britt Nieratko Says:

    hey, your post really assists, now i receive the same problems, and i have no idea on how to solve the issue. finanlly i search yahoo and found your post, it helps me get rid of my trouble. thanks once againjust one thing, can i paste your article on my site? i will add the source.regards!

  8. admin Says:

    Feel free to post my article on your site. As long as I get credit. :)

  9. 在线代理 Says:

    I really like following your blog as the articles are so simple to read and follow. Excellent. Please keep up the good work. Thanks.

  10. 在线代理 Says:

    Wow, I never new that, much appreciated.

  11. LENOVO4446 Says:

    Thanks for taking the time to post such a detailed and informative article.

  12. Perry Rokisky Says:

    Your blog is fantastic and quite useful. Keep posting the visual basic related articles more..

    I love .net. I started using from VB5.0 with windows 98 operating system. I love the way Visual studio 6 designed. Though the recent Visual studio 2010 is much useful with all bells and whistles, I still love visual studio 6.0.

    Thank you so much for a great blog post.

  13. Tarun Agarwal Says:

    Wonderful blog .. but i seem to have a wierd problem I did all the settings as mentioned but the moment i select Firebird data provider an add connection window opens up after which on pressing any key that window shuts down automatically.. Any key press the window closes. What could be the issue. If not is there any other method i could connect to the firebird database thrugh visual studio

  14. admin Says:

    That usually indicates a typing mistake in the config file.

  15. Gibo Says:

    I’m having the same problem as the one posted above from Tarun Agarwal. The Data Source connection dialog box instantly closes the moment I typed in any of the parameter/fields. I’ve tried it in both VS2010 and VS2012. What could be causing this error? I don’t think I ever committed a typing mistake in the config file as I didn’t make any modifications to it. I’m a heavy user of Firebird DDEX so it’s really a must for me to get it working lest I will be forced to use a different database if I can’t make data binding.

  16. Gibo Says:

    I’ve finally figured the error out, “Re: Firebird Data Source connection dialog box”.

    - Uninstall the Firebird DDEX v3.x.x

    - You have to remove all the old Firebird DDEX (i.e., v2.xx) reference in any the CONFIG files from the Microsoft.NET respective folders. In short, remove any occurrence of the word Firebird in the machine.config file

    ex.:
    .NET2 –> C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config
    .NET4 –>
    C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config

    - Re-Install the Firebird DDEX v3.x.x

    Hope this would be of help to others. More power!

  17. sharan Says:

    Wonderful blog .. after visiting so many websites i found your blog.i follow as you said but still i am not able to find .net provider for firebird in vs2010.i replaced my version number in machine.config by 4.1.0.0. please help me for further proceeding in my project.
    i am using firebird DDEX v3.0.1.0.

  18. Richa Says:

    Hi

    I have used all these steps on vs2013 professional. i have windows 8.1. But don’t know why the firebird data provider is not shown in New connection window for entity framework. Any help would be appreciated. I have been trying since last two days.

Leave a Reply