user1434177
user1434177

Reputation: 1977

firebird c# connect to a remote db

I am working on some existing project and I am trying to make it go from many firebird databases on the client end to one server based database.

Unfortunately I am having some trouble with the connection string.

Is it possible to connect to a .fdb file on a remote server?

Currently the code is as follows:

var builder = new FbConnectionStringBuilder
        {
            Database = @"C:\test.db",
            ServerType = FbServerType.Embedded,
            Pooling = isPooled
        };

I have read some examples about how it can be done like the below but its not working:

FbConnectionStringBuilder(@"Database=192.168.1.235:C:\share\test.fdb;User ID=sysdba;Password=masterkey;")

It still connects to just the local directory C:\share\test.fdb. As that is not my ip address. Any help?

Upvotes: 0

Views: 4341

Answers (3)

Guillermo R. P.
Guillermo R. P.

Reputation: 1

Be sure fireBird is listening on port 3050, uncomment this lines in firebird.conf

RemoteServiceName=gds_db
RemoteServicePort=3050

restart the service.

Upvotes: 0

user1434177
user1434177

Reputation: 1977

Ok so I think I worked it out. You cannot access an embedded database remotely. So once the server software was installed and this was removed it all worked fine. Would be a handy feature to connect to it on a remote drive but ohh well.

Upvotes: 0

Mark Rotteveel
Mark Rotteveel

Reputation: 109174

The Database property is only for the database filename or alias, you need to use DataSource for the hostname or IP address and Port for the Firebird port. Check out .NET — Examples of use and Connection string parameters

Also the class FbConnectionStringBuilder is intended to simplify building a connection string (it has properties for the various connection string properties), so your first use is correct, but the second use is a bit odd.

Upvotes: 2

Related Questions