DotNetFirebird.org DotNetFirebird
Using Firebird SQL in .NET.
Wednesday, February 16, 2005

Using Database Aliases

Firebird newcomers often complain that you need to specify the full path to the database file in the connection string, like this:

FbConnection c = new FbConnection(@"Server=localhost;Database=C:\data\mydb.fdb;User=SYSDBA;Password=masterkey");

In Firebird 1.5 and higher you can use database aliases. Just add the database path to the aliases.conf file on the server:

mydb = c:\data\mydb.fdb

Then you can use this alias in the connection string instead of a database path:

FbConnection c = new FbConnection(@"Server=localhost;Database=mydb;User=SYSDBA;Password=masterkey");

This has many advantages:

  • The connection string is shorter.
  • Client applications don't have to know the exact location of a database file on server.
  • You can change the database file location without changing the connection string.
  • You can limit the databases that can be open to those in the aliases list (see Firebird server security).

Comments:

Is there a way to use/specify a BDE alias when using FbConnection
Blog comments are closed.



Previous

Archives