Ошибка подключения к базе данных unavailable 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.

asked Aug 12, 2016 at 10:41

Frosty840's user avatar

0

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.

answered Aug 12, 2016 at 11:32

Mark Rotteveel's user avatar

Mark RotteveelMark Rotteveel

101k193 gold badges141 silver badges199 bronze badges

9

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

answered Mar 11 at 16:42

Kyo's user avatar

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.

asked Aug 12, 2016 at 10:41

Frosty840's user avatar

0

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.

answered Aug 12, 2016 at 11:32

Mark Rotteveel's user avatar

Mark RotteveelMark Rotteveel

101k193 gold badges141 silver badges199 bronze badges

9

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

answered Mar 11 at 16:42

Kyo's user avatar

qubasesx писал(а):Если в свойстве DatabaseName написать 192.168.0.5:C:\Elektroizolator\BASE.FDB (свой ip и ПОЛНЫЙ (важно) адрес к exe-шнику
то всё чудесным образом начинает работать (проверено на 3-х компьютерах). Идиотизм если задуматься, но работает)))
Little_Roo, благодарю за мысль!

Вообще-то Птица позволяет коннетиться к нерасшаренной базе — чем я у себя в гимназии и пользуюсь — строка коннекта выводится (для директора и завуча) — а пионЭры базочку не…и не видят…. (вот я сволочь какая учительская :shock: )

qubasesx писал(а):Little_Roo писал(а):А может проще, и надежнее, убрать IBConnection и перейти на Zeos ?
А правда будет надёжнее? Я просто думал, что раз компонента до сих пор поставляется в лазаре, то она самая надёжная? Нет?

Насчет того, что до сих пор поставляется….хорошие, простые, понятные, надежные…до поры…жигули….
А вот если Вы хотите озаботиться некоем проектом, да над сетью (где клиентов явно >1), то ip, zeos, …» …и ради бога, не читайте советских газет…»(С)(профессор Преображенский)
В догонку —
при работе с Птицей — на локальной (своей машине) устанавливать ТОЛЬКО коннект TCP/IP
В путях — либо
localhost:{ваш путь к базе}
либо
127.0.0.1:{ваш путь к базе}

Да, совсем забыл, что было мне непонятно —
Ваша база локальная ? Тобишь каждая копия ея располагается на компах, чье число > 1 и редактирование доступно юзеру данного компа и не доступно остальным, или же эта база доступна по сети клиентам, и тогда появляется термин многопользовательский доступ… Или….???

Перейти к содержимому

На днях столкнулся с проблемой, старый builder 6-ой не хотел открывать мою firebird (2.1) базу данных. Я пытался открыть с помощью InterBase и ловил ошибку “unavailable database”.

С помощью утилиты ibexpert база данных открывалась и всё было хорошо.

Решение:

Вобщем файл gds32.dll, который старый builder 6 кладёт в system32 (или SysWow64) является, видимо, старьем, которое не может открыть мою базу данных. Я взял свой gds32.dll и закинул его в syswow64 (или в system32 если у вас х32) и заменил вместо того gds32.dll, теперь всё ок.

Итак, если у вас builder не открывает базу данных firebird fdb и вы получаете ошибку unavailable database, то попробуйте положить свой (если нету, то мой) gds32.dll в папку system32, или syswow64. Я на всякий случай этот файл и в папку bin (builder’а) положил, там где его exe-шник. Зато работает. :-)

Мой gds32.dll

https://yadi.sk/d/koFn01b0gG6jU

Всё работает, ура:

fdb builder

fdb builder

Буду благодарен, если поделитесь:

—>

1.  С момента создания базы новой, могут быть сложности создания в ID триггеров и генератора, будет вылетать ошибки с этим CREATE SEQUENCE GEN_….

Решение: Просто создать всю работу с подключением в IB Expert не по пути к файлу а по localhost как удаленно соединяемся

2. Копируем что надо gds32.dll, qtintf70.dll….

3. Вылетает такая ошибка в программе  unsuccessful execution caused by an unavailable resource . Решение в FIB соединение прописать примерно так localhost:c:\dir\data.gdb  добавив localhost , так как в Delphi показывает ОК, а при запуске описанная ошибка.

4. Может ошибка типа отклонения соединения с хостом(базой ). где вообще не ставился никогда драйвера сервера firebird как раз на localhost ошибка с fbembed.dll.

Иной вариант для компов где вообще нет ничего firebird, в Delphi вместо gds32 прописываем fbembed.dll (в pFIBDatabase1), качаем

http://www.ibase.ru/firebird.htm#drv (Firebird 2.0.5 —  embedded) Который я скачал (скачать Firebird-2.0.5.13206-2_embed.zip в хранилище сайта ), ложим туда прогу и работает

где то так…

MainPath2:=ExtractFilePath(Application.ExeName);
MainPath2:=»+MainPath2+’\IPHOST.GDB’;
pFIBDatabase1.LibraryName:=’fbembed.dll’;
pFIBDatabase1.DBName:=MainPath2;

pFIBDatabase1.Open;
ipSDS.Active:=true;

Ниже из форму по этому

1.Одна из самых часто встречаемых:
«Can’t format message 13:96 — message file m:\my\firebird.msg not found.
Unavailable database.»

Вообще, здесь 2 ошибки:

«Can’t format message 13:96 — message file m:\my\firebird.msg not found.» — говорит о том, что не найден файл «firebird.msg». Самая безобидная, влияет на расшифровку, что именно произошло.

«Unavailable database» — обычно возникает, если не может найти SQL сервер.
За подключение к серверам баз данных отвечают файлы:
— fbclient.dll или gds32.dll -предназначен для подключения в многопользовательском варианте к серверам баз данных в сети или локальном компьютере;
— fbembed.dll -предназначен для подключения монопольно к базам данных, на локальном компьютере;

Решение проблемы:
проверьте, какие файлы находятся рядом с программой:
— если файл fbclient.dll или gds32.dll, то должен быть установлен сервер баз данных; этот файл имеет наивысший приоритет для программы; по этой причине, при всем желании вы не сможете подключиться если не стоит сервер баз данных.
— если файл fbembed.dll, то есть возможность подключения без установки сервера баз данных, но тогда должны отсутствовать фалы fbclient.dll или gds32.dll, как говорилось выше, они имеют приоритет;

Понравилась статья? Поделить с друзьями:
  • Ошибка подписания xml на госзакупках
  • Ошибка подключения к базе данных ms sql
  • Ошибка подключения к акциз транспорт
  • Ошибка подписания curthumbprint не определено 0x800a1391
  • Ошибка подключения к базе данных friday 13