How to connect to a remote Firebird Database in C#

0

I have recently accepted a project from a company. I have to display data from there database. I got the files on my local computer and created a program to their liking but when I replace the path and datasource in the connection string an error occurs. The error reads that

FirebirdSql.Data.FirebirdClient.FbException (0x80004005): Your user name and password are not defined. Ask your database administrator to set up a Firebird login.

So afterwards I copied the database on their local pc that has access to this remote server. I changed the connection string to where the DB is located on the local pc. Used the same username and password and then the connection worked.

A littile more about their server. The server is setup for a program which connects to their DB and runs on the server. The company's employees works from this program on their local computers. I do not have direct access to this server since the server does not connect to the internet at all. I used teamviewer to test my program.

So here is my connection string both the remote and local

The connection string that follow is for their network

connectionString = "Server=192.168.1.10;User=sysdba;Password=masterkey;Charser=NONE;Database=\\192.168.1.10\\DB\\DB.fdb";

The connection string that follow is for the local pc at the company I tested on using teamviewer.

connectionString = "Server=localhost;User=sysdba;Password=masterkey;Charser=NONE;Database=C:\DB\DB.fdb";

NOTE: I am not sure if the program the employees use might interfere with the one I created.

c#
connection
firebird
remote-access
remote-server
asked on Stack Overflow Nov 2, 2015 by SandMan • edited Dec 2, 2015 by Limon Monte

3 Answers

0
  1. Verify with isql if you can connect to the database, see this article
  2. Verify your code with the example on the Firebird site
  3. Check the aliases.conf
  4. Use a GUI tool like IBExper to manage users and databases

Anyway is better, for security reason, to use another user instead of sysdba.

answered on Stack Overflow Nov 2, 2015 by Max
0

Passwords to firebird are local to the server (in its security2.fdb). If you copy the database to your local machine (this indicates lax security BTW), and access it through a local Firebird server, it will use the security2.fdb of that local machine. The sysdba password you have is valid on your local machine (it is the Firebird default).

Clearly the password on the server is different. You need to find out what the password is or ask their DBA to give you a specific account.

As to your comment on the other answer that the database is in a shared folder: do not do this. Firebird databases should be accessed by one (or more) server processes on the same machine. Clients etc should connect through the server, and not open a shared file. Trying to open a shared database file is blocked by default, but if done could potentially corrupt the database; also having a database on a shared folder is a bad security practice.

answered on Stack Overflow Nov 3, 2015 by Mark Rotteveel
0

This might be too late but as a reference for the others, this is how I connect to the Firebird Database that is place in the other server.

This is the sample connection string if Firebird is installed in the same server:

connectionString = "Server=localhost;User=sampleusername;Password=samplepassword;Charser=NONE;Database=C:\DB\DB.fdb";

So if it is installed to different server, just get the IP of the the server and location of the FDB file from the server. For example, server IP is 192.168.1.123, the following will be the connection string:

connectionString = "Server=192.168.1.123;User=sysdba;Password=masterkey;Charser=NONE;Database=192.168.1.123:C:\DB\DB.fdb";

Just supplied the server IP with colon in front and the followed by the full path of the database. And for the server, just set the same IP Address.

I hope that this can help the others. Thanks.

answered on Stack Overflow Jan 28, 2019 by yhAm

User contributions licensed under CC BY-SA 3.0