Frosty840
Frosty840

Reputation: 8335

How to resolve Firebird "unavailable database" error on a remote database?

I have a Firebird 2.0 database running on a remote Windows XP PC.
Using the ADO.net connection provider, I configure the connection as follows:

Dim x As New FirebirdSql.Data.FirebirdClient.FbConnectionStringBuilder
x.Database = "[hostname]:FileShare:/db/REMOTE_SVR.FDB"
x.UserID = "SYSDBA"
x.Password = "masterkey"

Dim y As New FirebirdSql.Data.FirebirdClient.FbConnection(x.ConnectionString)
y.Open()

Attempting to open the connection raises an FbException, with the message "unavailable database".

Downloading the ODBC drivers and attempting to connect with those settings produces the same error message.

I have copied the database file to my development environment and verified that I can connect to x.Database = "c:\testdb\REMOTE_SVR.FDB" with these settings (with a local install of Firebird 2.0 Server).

I have confirmed that the Firebird 2.0 Server is running on the remote PC. The fileshare in which the DB is located doesn't require any login or permissions.

I'm probably doing something dumb, but I'm out of ideas.

Upvotes: 7

Views: 25679

Answers (2)

Kyo
Kyo

Reputation: 91

My answer is not about setup connection using ADO.net, but I still try to answer how to connect to remote FDB from Windows.

  1. In firebird.conf set RemoteFileOpenAbility to 1. This parameter will allow your DBMS connect to DB located in remote folder. Also check that Redirection parameter is set to 0 or is commented with #.

  2. Download PSTools from https://learn.microsoft.com/en-us/sysinternals/downloads/psexec, unpack it.

  3. From PSTools folder via CMD (started as admin) execute psexec -i -s cmd.exe, accept agreement.

  4. In popped-up CMD's window execute whoami to check that you are now identified as nt authority\system.

  5. In that window execute such command:

net use z: \\123.111.111.111\my_share /persistent:yes, where z is a network drive letter, you want to assign, and 123.111.111.111\my_share is an address of your network share. If the command executed successfully you will see new network drive in the Explorer.

If you got System error 58, try to execute command with specifying user/password in quotes like:

net use z: \\123.111.111.111\my_share /persistent:yes /user:"your username" "your password"

If in the future you will need to disconnect that network drive, perform step 3, then execute net use z: /delete. Or just reboot OS.

  1. Now you can launch your client (ibexpert, dbeaver, etc.) and connect to remote FDB file:
  • Server name: localhost
  • FDB file path: Z:/path_to_FDB/some_db.FDB

Upvotes: 2

Mark Rotteveel
Mark Rotteveel

Reputation: 108941

Firebird will - by default - not open database files that are located on a network share. The file must be on a physical disk of the server. This is done to protect the database against corruption from incorrect or insufficient locking of the file (eg when accessed by multiple Firebird server processes from different machines).

So you need to move the database to one of the real drives of the machine that hosts the Firebird server process.

Upvotes: 9

Related Questions