1
votes

We're having trouble connecting to a remote Firebird server using the .NET provider FbConnectionStringBuilder class. We can connect to a local database file in either embedded or server mode however when it comes to establishing a connection to a remote server we can't establish the connection.

We assign properties of the FbConnectionStringBuilder class with the following code (server mode). I have omitted the code which assigns properties for embedded mode.

var cs = new FbConnectionStringBuilder
{
    Database = databaseSessionInfo.PathAbsoluteToDatabase,
    Charset = "UTF8",
    Dialect = 3,
};

cs.DataSource = databaseSessionInfo.Hostname;
cs.Port = databaseSessionInfo.Port;
cs.ServerType = (FbServerType)databaseSessionInfo.Mode;
cs.Pooling = true;
cs.ConnectionLifeTime = 30;

if (databaseSessionInfo.UseCustomUserAccount)
{
    cs.UserID = databaseSessionInfo.Username;
    cs.Password = databaseSessionInfo.Password;
}
else
{
    cs.UserID = Constants.DB_DefaultUsername;
    cs.Password = Constants.DB_DefaultPassword;
}

Pretty straightforward. Our software contains a connection configuration screen whereby a user can supply different connection properties. These properties get assigned to the FbConnectionStringBuilder class using the code above.

The connection builder class outputs a connection string in the following format:

initial catalog="P:\Source\database.fdb";character set=UTF8;dialect=3;data source=localhost;port number=3050;server type=Default;pooling=True;connection lifetime=30;user id=USER;password=example

However literature on Firebird connection strings as indicated on this page (Firebird Connection Strings) talk of a different structure. I can only assume the FbConnectionStringBuilder class builds a Firebird connection string satisfying the requirements of Firebird.

  1. Does the FbConnectionStringBuilder class append the hostname to the connection string correctly?
  2. The Firebird server is running on the server. I assume there is no need to install it on the client?
  3. What libraries need to be installed with the client to support a remote server connection?
  4. Are we doing this right?

Any advice is appreciated.

1

1 Answers

0
votes

Answering your questions:

1) Yes it will.

2) Correct, the client library will connect over the network.

3) If you use the ADO library, just FirebirdSql.Data.FirebirdClient.dll

4) Maybe, I dont know if this will help but this is how I connect.

FbConnectionStringBuilder ret = new FbConnectionStringBuilder();
ret.DataSource = Host;
ret.Port = Port;
ret.Database = Database;
ret.UserID = User;
ret.Password = Password;
ret.Charset = CharacterSet; 
FbConnection ret = new FbConnection(connectionString);

Interestingly, what is the absolute path you are providing to the StringBuilder ? Is it the server absolute path, or some kind of network mapped drive?

Also, I assume you've reviewed firewall settings and allowing port 3050 inbound.