Firebird error unknown isc error 335545106

I had 2 servers that were using Firebird 2.5. Each of the servers had a separate database and one of them was connecting to the other one to retrieve some data. One of the servers switched to Fireb...

I have done some testing with a Firebird 2.5 (2.5.8) and Firebird 3 (3.0.4) on the same server with different ports using the following simple statement (and modifying some parts depending on what I’m testing) to see what kind of connection failures I can produce.

set term #;
execute block returns (tblname char(31))
as
begin
  for execute statement 'select rdb$relation_name from rdb$relations where coalesce(rdb$system_flag, 0) = 0' 
    on external data source 'localhost/3051:D:datadbtestdatabase.fdb' 
      as user 'sysdba' password 'masterkey'
    into tblname
  do suspend;
end#
set term ;#

Firebird 3 to Firebird 2.5

Using this statement, I can get error «Your user name and password are not defined.» from Firebird 3 to 2.5 in the following situations:

  1. Firebird 3 has a AuthClient1 configuration that does not include Legacy_Auth. Firebird 3 cannot authenticate to Firebird 2.5 as Firebird 2.5 only knows about the legacy authentication mechanism.

    To fix this, add Legacy_Auth to the AuthClient setting in firebird.conf of the Firebird 3 server (for example set it to AuthClient = Srp, Legacy_Auth) and restart the server.

    This point is most likely your problem.

  2. Not specifying username and password (ie leaving as user 'sysdba' password 'masterkey' out of the execute statement). This is probably due to the difference in authentication mechanisms as Firebird doesn’t know the actual password with the SRP protocol and therefor will not be able to authenticate to the other server.

    Specifying a username and password fixes this.

Firebird 2.5 to Firebird 3

In reverse direction (Firebird 2.5 to 3), I cannot establish a connection in the following situations:

  1. Authenticating with a username and password that exists only as a Srp user. This results in error «Your user name and password are not defined.» as Firebird 2.5 only supports the legacy authentication, and as a result can only authenticate with users that exists for the Legacy_UserManager plugin in Firebird 3.

    Create a user (either with the same name or a different name) for the Legacy_UserManager plugin:

    create user theuser password 'thepassword' using plugin Legacy_UserManager;
    commit;
    

    If this results in error «Missing requested management plugin», then you need to edit the Firebird 3 firebird.conf and add Legacy_UserManager to the UserManager setting (eg set to UserManager = Srp, Legacy_UserManager; the default is only Srp) and restart Firebird.

    As SYSDBA you can check on the Firebird 3 server for which plugin (or plugins!) a user exists by executing

    select SEC$USER_NAME, SEC$PLUGIN 
    from SEC$USERS
    
  2. Firebird 3 has setting WireCrypt = Required (this is the default!). This produces the error «connection rejected by remote interface».

    To fix this, set WireCrypt = Enabled in the firebird.conf of the Firebird 3 server and restart the server.

  3. Not specifying username and password (ie leaving as user 'sysdba' password 'masterkey' out of the execute statement). This produces an error «unknown ISC error 335545106» (actual message is «Error occurred during login, please check server firebird.log for details» if a Firebird 3 message file is used) where the log of Firebird 3 says «No matching plugins on server», this is probably due to the difference in authentication mechanisms.

    Specifying a username and password fixes this.

  4. Firebird 3 has a AuthServer configuration that does not include Legacy_Auth (the default is Srp only!). This also produces error «unknown ISC error 335545106» (actual message is «Error occurred during login, please check server firebird.log for details» if a Firebird 3 message file is used) where the log of Firebird 3 says «No matching plugins on server».

    To fix this, add Legacy_Auth to the AuthServer setting in firebird.conf of the Firebird 3 server (for example set it to AuthServer = Srp, Legacy_Auth) and restart the server.

And, of course, in both directions error «Your user name and password are not defined.» can also be produced by using non-existent users or wrong passwords.



1. The setting AuthClient is relevant here as the server is acting as a client when executing an execute statement ... on external data source ...

Начало » Использование СУБД » Firebird, HQbird, InterBase » FB3 как правильно использовать embedded? (Подключение из консоли)

FB3 как правильно использовать embedded? [сообщение #1327] Fri, 13 January 2023 18:16 Переход к следующему сообщению
svd в настоящее время не в онлайне 
svd

Сообщений: 17
Зарегистрирован: November 2022

Junior Member

Всем привет.

немогу подключиться по embedded и создать файл базы данных. Использую библиотеку на 32 бита.

Комп под Win10 x64.
Установил FB3.0.7 Win64.
Из консоли набираю

C:Omnicell_UpdateRDSUpdate_workingProgramme>Mach4Script.exe  -l C:Program FilesFirebirdFirebird_3_0WOW64fbclient.dll C:RDazTFSTechnikMACH4DataBasetest_Create.sql                                                              MACH4 IBEScript Version 2022.5.24.1 Copyright (c) 2002-2021 IBExpert Ltd (www.ibexpert.com)                                                                                                                                                  
Executing script: C:RDazTFSTechnikMACH4DataBasetest_Create.sql
(Line: 13) : Creating database 'C:Mach4Database_EmptyMEDIMAT.FDB'... using C:Program FilesFirebirdFirebird_3_0WOW64fbclient.dll... FAILED!

Error in script: C:RDazTFSTechnikMACH4DataBasetest_Create.sql
Error occurred while executing following statement (line 13):
--------  STATEMENT ----------
CREATE DATABASE 'C:Mach4Database_EmptyMEDIMAT.FDB'
USER 'SYSDBA' PASSWORD 'masterkey'
PAGE_SIZE 8192
DEFAULT CHARACTER SET ISO8859_1 COLLATION ISO8859_1

--------  ERROR ----------
Unsuccessful execution caused by a system error that precludes successful execution of subsequent statements.
Error occurred during login, please check server firebird.log for details.
-------------------------------------------------------------------------------------------------------------
SQLCODE: -902
SQLSTATE: 08006
GDSCODE: 335545106


Script executed with errors.                                                                                                                                                                                                                 Total execution time: 31ms

скрип небольшой только на создание файла

SET SQL DIALECT 3;


 SET CLIENTLIB  "C:Program FilesFirebirdFirebird_3_0WOW64fbclient.dll";

SET NAMES ISO8859_1;

CREATE DATABASE 'C:Mach4Database_EmptyMEDIMAT.FDB'
USER 'SYSDBA' PASSWORD 'masterkey'
PAGE_SIZE 8192
DEFAULT CHARACTER SET ISO8859_1 COLLATION ISO8859_1;

В чем неправ?

выкинул из скрипта строчку с set clientlib и получаю ошибку типа

C:Omnicell_UpdateRDSUpdate_workingProgramme>Mach4Script.exe  -l C:Program FilesFirebirdFirebird_3_0WOW64fbclient.dll C:RDazTFSTechnikMACH4DataBasetest_Create.sql                                                              MACH4 IBEScript Version 2022.5.24.1 Copyright (c) 2002-2021 IBExpert Ltd (www.ibexpert.com)                                                                                                                                                  
Executing script: C:RDazTFSTechnikMACH4DataBasetest_Create.sql
(Line: 13) : Creating database 'C:Mach4Database_EmptyMEDIMAT.FDB'... using gds32.dll... FAILED!

Error in script: C:RDazTFSTechnikMACH4DataBasetest_Create.sql
Error occurred while executing following statement (line 13):
--------  STATEMENT ----------
CREATE DATABASE 'C:Mach4Database_EmptyMEDIMAT.FDB'
USER 'SYSDBA' PASSWORD 'masterkey'
PAGE_SIZE 8192
DEFAULT CHARACTER SET ISO8859_1 COLLATION ISO8859_1

--------  ERROR ----------
Firebird error.
unknown ISC error 335545106.
----------------------------
SQLCODE: -999
SQLSTATE: HY000
GDSCODE: 335545106


Script executed with errors.                                                                                                                                                                                                                 Total execution time: 94ms

[Обновления: Fri, 13 January 2023 18:20]

Известить модератора

Re: FB3 как правильно использовать embedded? [сообщение #1337 является ответом на сообщение #1335] Sat, 14 January 2023 14:49 Переход к предыдущему сообщениюПереход к следующему сообщению
svd в настоящее время не в онлайне 
svd

Сообщений: 17
Зарегистрирован: November 2022

Junior Member

Ну вроде как в 3.0 нет отдельно embedded и обычный fbclient.dll несет возможности embedded.
Я и использую WOW64fbclient.dll — 32разрядную библиотеку для этих манипуляций. Или там лежащая библиотека такого не умеет и необходимо уставливать Firebird3.0 for Win32 и его библиотека сможет так работать?

Re: FB3 как правильно использовать embedded? [сообщение #1395 является ответом на сообщение #1337] Thu, 19 January 2023 16:04 Переход к предыдущему сообщениюПереход к следующему сообщению
kdv в настоящее время не в онлайне 
kdv

Сообщений: 51
Зарегистрирован: June 2022

Member

svd писал(а) Sat, 14 January 2023 14:49

Ну вроде как в 3.0 нет отдельно embedded и обычный fbclient.dll несет возможности embedded.

НЕТ. fbclient.dll это в 3.0 только клиентская библиотека. Если коннект локальный, то она пытается найти engine12.dll, и вот это уже тогда будет embedded — т.е. сервер внутри dll, загружаемых каким-то exe.
Про соответствие разрядности уже написали.

Re: FB3 как правильно использовать embedded? [сообщение #1397 является ответом на сообщение #1395] Thu, 19 January 2023 16:48 Переход к предыдущему сообщениюПереход к следующему сообщению
МП в настоящее время не в онлайне 
МП

Сообщений: 222
Зарегистрирован: August 2022
Географическое положение: бурятский тун…

Senior Member

kdv

. fbclient.dll это в 3.0 только клиентская библиотека. Если коннект локальный, то она пытается найти engine12.dll, и вот это уже тогда будет embedded — т.е. сервер внутри dll, загружаемых каким-то exe.
Про соответствие разрядности уже написали.

наверное пора заводить FAQ

Re: FB3 как правильно использовать embedded? [сообщение #1436 является ответом на сообщение #1434] Sun, 22 January 2023 12:19 Переход к предыдущему сообщениюПереход к следующему сообщению
shavluk в настоящее время не в онлайне 
shavluk

Сообщений: 15
Зарегистрирован: June 2022
Географическое положение: Одеса

Junior Member

У себя вопрос с местонахождением клиента firebird решаю следующим образом:
1. Database.LibraryName прописываю полный путь к fbclient.dll. В моем случае осуществляется поиск, настроено в моем .ini-файле
2. Устанавливаю переменные окружения «FIREBIRD» и «FIREBIRD_MSG» (через SetEnvironmentVariable). Это папка где находится fbclient.dll

Более ничего не надо настраивать

Re: FB3 как правильно использовать embedded? [сообщение #1440 является ответом на сообщение #1436] Sun, 22 January 2023 19:23 Переход к предыдущему сообщениюПереход к следующему сообщению
Док в настоящее время не в онлайне 
Док

Сообщений: 91
Зарегистрирован: June 2022

Member

shavluk писал(а) Sun, 22 January 2023 12:19

У себя вопрос с местонахождением клиента firebird решаю следующим образом:
1. Database.LibraryName прописываю полный путь к fbclient.dll. В моем случае осуществляется поиск, настроено в моем .ini-файле
2. Устанавливаю переменные окружения «FIREBIRD» и «FIREBIRD_MSG» (через SetEnvironmentVariable). Это папка где находится fbclient.dll

Более ничего не надо настраивать

Жень, это для эмбедедд? о_О

А если не эмбедедд, но серверов несколько?

FPC/Lazarus (trunk) | Win10 x64 Ultim/Debian 11 amd64/Darwin x86_64 Monterey | Firebird 3.0.10 x64 | IBX by Rik

Re: FB3 как правильно использовать embedded? [сообщение #1441 является ответом на сообщение #1440] Sun, 22 January 2023 19:52 Переход к предыдущему сообщениюПереход к следующему сообщению
shavluk в настоящее время не в онлайне 
shavluk

Сообщений: 15
Зарегистрирован: June 2022
Географическое положение: Одеса

Junior Member

Да, эмбедедд в первую очередь.
У меня настройки клиента вообще не отличаются дла вариантов эмбедедд/сетевой.
Не хочу зависеть от уже остановленньіх чужих программ.
У меня все вариантьі установки «портабельньіе».

fbclient
project.exe
project.conf

В .conf-файле есть 2 главные настройки: путь к fbclient.dll и путь к БД
Но если не установить переменньіе окружения возникают проблемы с поиском firebird.msg

upd. Переменньіе окружения устанавливаются не для системьі целиком, а только внутри конкретного приложения. И не влияют ни на что прочее
upd2. Если серверов несколько (или версий серверов), то ставим в качестве клиента максимальную версию и подключаемся через него ко всем прочим серверам

[Обновления: Sun, 22 January 2023 19:57]

Известить модератора

Re: FB3 как правильно использовать embedded? [сообщение #1442 является ответом на сообщение #1441] Sun, 22 January 2023 21:48 Переход к предыдущему сообщениюПереход к следующему сообщению
kdv в настоящее время не в онлайне 
kdv

Сообщений: 51
Зарегистрирован: June 2022

Member

чтобы «не зависеть от настроек чужих программ», не надо распихивать свою приладу и embedded по разным папкам. Это для чего? Чтобы при двух разных приложениях использовать один embedded? Экономия ни о чем.
А несчастный пользователь, скопировав только папку с вашим приложением на другой комп, получит неработающее.
(поправлюсь — если embedded в «подпапке», то всё будет ок, кроме упомянутых «переменных окружения. В итоге ваше приложение «непортабельное»),

p.s. чужим приложениям ваш embedded до лампочки, будь он хоть в отдельной папке.

[Обновления: Sun, 22 January 2023 21:50]

Известить модератора

Re: FB3 как правильно использовать embedded? [сообщение #1448 является ответом на сообщение #1442] Mon, 23 January 2023 12:10 Переход к предыдущему сообщениюПереход к следующему сообщению
shavluk в настоящее время не в онлайне 
shavluk

Сообщений: 15
Зарегистрирован: June 2022
Географическое положение: Одеса

Junior Member

У меня клиент находится во вложенной папке, рядом с exe
«Несчастный пользователь» скопирует только папку с программой и получит рабочего клиента без киких-либо дополнительных действий
Путь к папке fbclient у меня относительный

По поводу перемных окружения вы говорите глупости. Как минимум из-за наличия функций ExpandFileName

Re: FB3 как правильно использовать embedded? [сообщение #1449 является ответом на сообщение #1448] Mon, 23 January 2023 12:12 Переход к предыдущему сообщениюПереход к следующему сообщению
shavluk в настоящее время не в онлайне 
shavluk

Сообщений: 15
Зарегистрирован: June 2022
Географическое положение: Одеса

Junior Member

fb_lib := MainIniFile.ReadString('SYSTEM', 'firebird', '');
if fb_lib <> '' then
begin
  fb_lib := ExpandFileName(fb_lib);
  SetGlobalEnvironment('FIREBIRD', fb_lib);
end else
  fb_lib := GetFirebirdPath;

if not DirExists(fb_lib) then
  fb_lib := ''
else
  AddDllDirectory(fb_lib);

SetGlobalEnvironment('FIREBIRD_MSG', GetGlobalEnvironment('FIREBIRD'));

[Обновления: Mon, 23 January 2023 12:13]

Известить модератора

Re: FB3 как правильно использовать embedded? [сообщение #1457 является ответом на сообщение #1456] Mon, 23 January 2023 22:34 Переход к предыдущему сообщению
shavluk в настоящее время не в онлайне 
shavluk

Сообщений: 15
Зарегистрирован: June 2022
Географическое положение: Одеса

Junior Member

Да, название процедуры немного неудачное. По умолчанию вызывается SetEnvironmentVariable (только текущий процесс)

Цитата:

. The SetEnvironmentVariable function sets the value of an environment variable for the current process.

автоматическая буквица в цитате выбешивает

function SetGlobalEnvironment(const Name, Value: string; const Local: Boolean = True;
  const User: Boolean = True): Boolean;
resourcestring
  REG_MACHINE_LOCATION = 'SystemCurrentControlSetControlSession ManagerEnvironment';
  REG_USER_LOCATION = 'Environment';
begin
  Result := Local;
  SetEnvironmentVariable(PChar(Name), PChar(Value));
  if not Result then
  with TRegistry.Create do
  try
    if User then { User Environment Variable }
      Result := OpenKey(REG_USER_LOCATION, True)
    else { System Environment Variable }
    begin
      RootKey := HKEY_LOCAL_MACHINE;
      Result  := OpenKey(REG_MACHINE_LOCATION, True);
    end;
    if Result then
    begin
      WriteString(Name, Value); { Write Registry for Global Environment }
      { Update Current Process Environment Variable }
      SetEnvironmentVariable(PChar(Name), PChar(Value));
      { Send Message To All Top Window for Refresh }
      SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, Integer(PChar('Environment')));
    end;
  finally
    Free;
  end;
end;

[Обновления: Mon, 23 January 2023 22:37]

Известить модератора

Переход к форуму:

  

Текущее время: Thu Feb 09 21:48:20 MSK 2023

Общее время, затраченное на создание страницы: 0.01785 секунд

1. Where do I get Jaybird?

1.1. Maven

1.1.1. Jaybird 5

Jaybird 5 is available on Maven Central:

groupId

org.firebirdsql.jdbc

artifactId

jaybird,

version

5.0.1.<java> (where <java> is java11 or java8)

Contrary to Jaybird 4, a Maven relocation artifact with artifact id jaybird-XX (with XX jdk17, jdk18) is no longer provided.
Please make sure you use the jaybird artifactId.

For example, for Java 11:

<dependency>
    <groupId>org.firebirdsql.jdbc</groupId>
    <artifactId>jaybird</artifactId>
    <version>5.0.1.java11</version>
</dependency>

If you want to use Type 2 support (native or embedded), you need to explicitly include JNA 5.12.1 as a dependency:

<dependency>
    <groupId>net.java.dev.jna</groupId>
    <artifactId>jna</artifactId>
    <version>5.12.1</version>
</dependency>

1.1.2. Jaybird 4

Jaybird 4 is maintained at least until the end of 2023.
However, we recommend upgrading to Jaybird 5.

Jaybird 4 is available from Maven Central:

groupId

org.firebirdsql.jdbc

artifactId

jaybird

version

4.0.9.<java> (where <java> is java11, java8 or java7)

For backwards compatibility, we also provide a Maven relocation artifact with artifact id jaybird-XX (with XX jdk17 or jdk18.
However, we recommend switching to the jaybird artifact.

For example, for Java 11:

<dependency>
    <groupId>org.firebirdsql.jdbc</groupId>
    <artifactId>jaybird</artifactId>
    <version>4.0.9.java11</version>
</dependency>

If your application is deployed to a Java EE application server, you will need to exclude the javax.resource:connector-api dependency, and add it as a provided dependency:

<dependency>
    <groupId>org.firebirdsql.jdbc</groupId>
    <artifactId>jaybird</artifactId>
    <version>4.0.9.java11</version>
    <exclusions>
        <exclusion>
            <groupId>javax.resource</groupId>
            <artifactId>connector-api</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>javax.resource</groupId>
    <artifactId>connector-api</artifactId>
    <version>1.5</version>
    <scope>provided</scope>
</dependency>

If you want to use Type 2 support (native, local or embedded), you need to explicitly include JNA 5.5.0 as a dependency:

<dependency>
    <groupId>net.java.dev.jna</groupId>
    <artifactId>jna</artifactId>
    <version>5.5.0</version>
</dependency>

1.1.3. Jaybird 3

Jaybird 3 is end-of-life and will receive no further updates.
We recommend upgrading to Jaybird 5.

Jaybird 3 is available from Maven Central:

groupId

org.firebirdsql.jdbc

artifactId

jaybird-XX (where XX is jdk18 or jdk17)

version

3.0.12

For ease of use, we also provide a Maven relocation artifact with artifact id jaybird.
For Jaybird 3 this relocation artifact points to jaybird-jdk18.

For example, for Java 8:

<dependency>
    <groupId>org.firebirdsql.jdbc</groupId>
    <artifactId>jaybird-jdk18</artifactId>
    <version>3.0.12</version>
</dependency>

If your application is deployed to a Java EE application server, you will need to exclude the javax.resource:connector-api dependency, and add it as a provided dependency:

<dependency>
    <groupId>org.firebirdsql.jdbc</groupId>
    <artifactId>jaybird-jdk18</artifactId>
    <version>3.0.12</version>
    <exclusions>
        <exclusion>
            <groupId>javax.resource</groupId>
            <artifactId>connector-api</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>javax.resource</groupId>
    <artifactId>connector-api</artifactId>
    <version>1.5</version>
    <scope>provided</scope>
</dependency>

If you want to use Type 2 support (native, local or embedded), you need to explicitly include JNA 4.4.0 as a dependency:

<dependency>
    <groupId>net.java.dev.jna</groupId>
    <artifactId>jna</artifactId>
    <version>4.4.0</version>
</dependency>

1.1.4. Jaybird 2.2

Jaybird 2.2 is end-of-life and will receive no further updates.
We recommend upgrading to Jaybird 5.

1.2. Download

Firebird can be downloaded from the Firebird website, under Downloads, JDBC Driver.

Alternatively, you can go directly to GitHub and download Jaybird from the jaybird releases.

2. Where can I get the sourcecode?

All Jaybird distribution zips contain a jaybird-<version>-sources.zip with the sources used for that specific version.
The full Jaybird sourcecode is also available from GitHub in the jaybird repository:

Each release is also tagged in the repository.

3. How is Jaybird licensed?

Jaybird JDBC driver is distributed under the GNU Lesser General Public License (LGPL).
Text of the license can be obtained from http://www.gnu.org/copyleft/lesser.html.

Using Jaybird (by importing Jaybird’s public interfaces in your Java code), and extending Jaybird by subclassing or implementation of an extension interface (but not abstract or concrete class) is considered by the authors of Jaybird to be dynamic linking.
Hence, our interpretation of the LGPL is that the use of the unmodified Jaybird source does not affect the license of your application code.

Even more, all extension interfaces to which an application might want to link are released under dual LGPL/modified BSD license.
Latter is basically «AS IS» license that allows any kind of use of that source code.
Jaybird should be viewed as an implementation of that interfaces and the LGPL section for dynamic linking is applicable in this case.

3.1. Which version of the LGPL applies?

Current releases of Jaybird do not explicitly specify an LGPL version.
This means that you can choose which version applies.
Future versions of Jaybird may specify an explicit version, or be released under a different license.

4. Which Java versions are supported?

Jaybird 5

Jaybird 5 supports Java 8, 11 and 17.
Support for Java 9 and higher is limited to Java 11, 17 and the most recent LTS version after Java 17 and
the latest Java release.
Currently, that means we support Java 8, 11, 17 and 19.

Jaybird 5 is the last version to support Java 8 and 11, support will be dropped with Jaybird 6, raising the minimum supported version to Java 17.

Jaybird 5 will serve as a form of long-term support for Java 8 and 11, with maintenance releases guaranteed at least until the release of Jaybird 7.

Jaybird 4

Jaybird 4 supports Java 7, 8, 11 and 17.
Support for Java 9 and higher is limited to Java 11, 17 and the most recent LTS version after Java 17 and
the latest Java release.
Currently, that means we support Java 7, 8, 11, 17 and 19.

Jaybird 4 is the last version to support Java 7, support will be dropped with Jaybird 5.
Jaybird 4 is still maintained (at least until the end of 2023), but we recommend upgrading to Jaybird 5.

Jaybird 3

Jaybird 3 supports Java 7 and 8 and has basic support for Java 9 and higher using the Java 8 version of the driver.
Support for Java 9 and higher is limited to the latest LTS and current latest release, but in practice Jaybird should work on all Java 9+ versions.
Jaybird 3.0.12 is that last release of Jaybird 3, and is end-of-life.
We recommend upgrading to Jaybird 5.

Jaybird 2.2

Jaybird 2.2 supports Java 6, 7 and 8.
Jaybird 2.2.15 is that last release of Jaybird 2.2, and is end-of-life.
We recommend upgrading to Jaybird 5.

Jaybird 2.2.4 added basic support for Java 8 (JDBC 4.2), although not all JDBC 4.2 features are supported or fully implemented.

Jaybird 2.2.7 is the last version to support Java 5, support has been dropped with Jaybird 2.2.8.

Jaybird 2.2 is the last version to support Java 6, support has been dropped with Jaybird 3.

5. What is the Java 9 module name for Jaybird?

Jaybird itself is not (yet) modularized.
To ensure a stable module name, Jaybird, since 2.2.14 and 3.0.3, declares the automatic module name org.firebirdsql.jaybird.

6. Which Firebird versions are supported?

Jaybird 5

Jaybird 5 supports Firebird version 2.5, 3.0 and 4.0, and provides tentative support for Firebird 5.0.
Firebird 5.0 will become fully supported in the first release after Firebird 5.0.0.

Jaybird 5 is the last version to support Firebird 2.5.
Future versions of Jaybird are not guaranteed to work with version 2.5 and earlier.

Jaybird 4

Jaybird 4 supports Firebird version 2.5, 3.0 and 4.0, and introduces support for Firebird 4.0 types DECLOAT, extended precision of NUMERIC and DECIMAL, and time zone types (TIME WITH TIME ZONE and TIMESTAMP WITH TIME ZONE).

Jaybird 4 only provides partial support for Firebird 5.0, and the generated-keys support does not work in all cases due to Firebird 5.0 now supporting multi-row RETURNING.
Full Firebird 5.0 support will become available in Jaybird 5.

Jaybird 3

Jaybird 3 supports Firebird versions 2.0 — 4.0.
Support for Firebird 4.0 is limited to the Firebird 3.0 feature set.
Formally, Firebird 5.0 is not supported, though in practice the problems are similar as for Jaybird 4.

Jaybird 3 is the last version to support Firebird 2.0 and 2.1.
Future versions of Jaybird are not guaranteed to work with version 2.1 and earlier.

Jaybird 2.2

Jaybird 2.2 supports Firebird versions 1.0 — 4.0.
Jaybird 2.2.4 added support for new features of Firebird 3.0 (e.g. BOOLEAN support).
Support for Firebird 4 is limited to the Firebird 3.0 feature set.

Jaybird 2.2 is the last version to support Firebird 1.0 and 1.5.
Future versions of Jaybird are not guaranteed to work with these versions.

7. Can Jaybird connect to Interbase?

Jaybird does not support Interbase, and as far as we know connecting to Interbase 6.0 and later will fail due to Firebird specific changes in the implementation.

8. Can Jaybird be used on Android

Jaybird does not work on Android.
It uses classes and Java features which are not available on Android.

Instead, we recommend building a webservice (e.g. REST-based) to mediate between your Android application and the database.

Documentation and Support

9. Where to get more information on Jaybird

10. Where to get help

  • On Stack Overflow, please tag your questions with jaybird and firebird

  • The Firebird-Java group and corresponding mailing list [email protected]

    You can subscribe to the mailing list by sending an email to [email protected]

  • Looking for professional support of Jaybird?
    Jaybird is now part of the Tidelift subscription.

  • The Firebird project home page

  • Firebird support and other Firebird mailing lists for questions not directly related to Jaybird and java.

12. Reporting Bugs

The developers follow the firebird-java Google Group.
Join the list and post information about suspected bugs.
List members may be able to help out to determine if it is an actual bug, provide a workaround and get you going again, whereas bug fixes might take a while.

When reporting bugs, please provide a minimal, but complete reproduction, including databases and sourcecode to reproduce the problem.
Patches to fix bugs are also appreciated.
Make sure the patch is against a recent master version of the code.
You can also fork the jaybird repository and create pull requests.

Connecting to Firebird

13. JDBC URLs (java.sql.DriverManager)

13.1. Pure Java (default)

Default URL format:

jdbc:firebirdsql://host[:port]/<database>

This will connect to the database using the Type 4 JDBC driver using the Java implementation of the Firebird wire-protocol.
This is best suited for client-server applications with dedicated database server.
Port can be omitted (default value is 3050), host name must be present.

The <host> part is either the hostname, the IPv4 address, or the IPv6 address in brackets (eg [::1]).
Use of IPv6 address literals is only supported in Jaybird 3 or newer with Firebird 3 or newer.

The <database> part should be replaced with the database alias or the path to the database.
In general, it is advisable to use database aliases instead of the path of the database file as it hides implementation details like file locations and OS type.

On Linux the root / should be included in the path.
A database located on /opt/firebird/db.fdb should use (note the double slash after port!):

jdbc:firebirdsql://host:port//opt/firebird/db.fdb

Deprecated, but still supported legacy URL format:

jdbc:firebirdsql:host[/port]:<database>

The legacy URL format does not support IPv6 address literals.

Jaybird 4 and higher also support:

jdbc:firebird://host[:port]/<database>
jdbc:firebird:host[/port]:<database>

13.2. Open Office/Libre Office (Pure Java)

Jaybird 5 and earlier can be used together with OpenOffice and LibreOffice Base.
To address some compatibility issues (and differences in interpretation of JDBC specifications) a separate sub-protocol is used:

jdbc:firebirdsql:oo://host[:port]/<database>

Jaybird 4 and higher also support:

jdbc:firebird:oo://host[:port]/<database>

13.3. Native (using Firebird client library)

Default URL format:

jdbc:firebirdsql:native://host[:port]/<database>

Legacy URL format:

jdbc:firebirdsql:native:host[/port]:<database>

Type 2 driver, will connect to the database using client library (fbclient.dll on Windows, and libfbclient.so on Linux).
Requires correct installation of the client library and — for Jaybird 2.2 or earlier — the Jaybird native library, or — for Jaybird 3 and higher — the JNA jar file.

jdbc:firebirdsql:local:<database>

Type 2 driver in local mode.
Uses client library as in previous case, however will not use socket communication, but rather access database directly.
Requires correct installation of the client library and — for Jaybird 2.2 or earlier —  the Jaybird native library, or — for Jaybird 3 and higher — the JNA jar file.

Jaybird 4 and higher also support:

jdbc:firebird:native://host[:port]/<database>
jdbc:firebird:native:host[/port]:<database>
jdbc:firebird:local:<database>

As of Jaybird 5, the separate “LOCAL” protocol implementation has been removed.
The JDBC URL sub-protocol jdbc:firebirdsql:local and jdbc:firebird:local are still supported but are now simply aliases for “native”.

13.4. Embedded Server

jdbc:firebirdsql:embedded:<database>

Similar to the Firebird client library, however fbembed.dll on Windows and libfbembed.so on Linux are used, falling back to fbclient.dll/libfbclient.so under the assumption it provides Embedded functionality.
Requires correctly installed and configured Firebird embedded library and — for Jaybird 2.2 or earlier — the Jaybird native library, or — for Jaybird 3 and higher — the JNA jar file.

Jaybird 4 and higher also support:

jdbc:firebird:embedded:<database>

14. Character sets

14.1. How can I specify the connection character set?

Jaybird provides two connection properties to specify the connection character set:

  • charSet with a Java character set name (alias: localEncoding)

    The Java character set name must map to an equivalent Firebird character set.

  • encoding with a Firebird character set name (alias: lc_ctype)

    The Firebird character set name — except NONE — must map to an equivalent Java character set.

For most applications, use only one of these two properties.

For special situations it is possible to specify both charSet and encoding to convert/reinterpret a character set into another character set, this is usually only necessary to fix data problems.

To phrase differently:

  • encoding=<firebird charset>: use connection encoding <firebird charset> and interpret in the equivalent Java character set

  • charSet=<java charset>: use Firebird equivalent of <java charset> as connection encoding and interpret in <java charset>

  • encoding=<firebird charset>&charSet=<java charset>: use connection encoding <firebird charset>, but interpret in <java charset>

The handling of Firebird character set NONE is slightly different, see below.

14.2. How does character set NONE work?

The Firebird character set NONE is a special case, it essentially means “no character set”.
You can store anything in it, but conversions to or from this character set are not defined.

Using character set NONE can result in incorrect character set handling when the database is used from different locales.

When used as a connection character set, Jaybird handles NONE as follows:

14.2.1. Jaybird 3 and higher

  • encoding=NONE means connection encoding NONE and interpret columns with character set NONE using the default JVM encoding, and interpret columns with an explicit character set in their equivalent Java character set

  • encoding=NONE&charSet=ISO-8859-1 the same, but instead of the JVM default, use ISO-8859-1

14.2.2. Jaybird 2.2 and earlier

  • encoding=NONE means use connection encoding NONE and interpret everything using the default JVM encoding

  • encoding=NONE&charSet=ISO-8859-1 the same, but instead of the JVM default, use ISO-8859-1

14.3. What happens if no connection character set is specified?

When no character set has been specified explicitly, Jaybird 2.2 and earlier, and Jaybird 3.0.2 and higher default to connection character set NONE.
See How does character set NONE work? for details on character set NONE.

Jaybird 3.0.0 and 3.0.1, however, will reject the connection, see How can I solve the error «Connection rejected: No connection character set specified».

In Jaybird 3 it is possible to override the default connection character set by specifying system property org.firebirdsql.jdbc.defaultConnectionEncoding with a valid Firebird character set name.

Jaybird 3.0.2 introduces the system property org.firebirdsql.jdbc.requireConnectionEncoding, which — when set to true — will reject connections without a character set (which was the default behavior in Jaybird 3.0.0 and 3.0.1).

14.4. How can I solve the error «Connection rejected: No connection character set specified»

If no character set has been set, Jaybird 3 will reject the connection with an SQLNonTransientConnectionException with message «Connection rejected: No connection character set specified (property lc_ctype, encoding, charSet or localEncoding).
Please specify a connection character set (e.g. property charSet=utf-8) or consult the Jaybird documentation for more information.»

In Jaybird 3.0.0 and 3.0.1 this error will be thrown if the character set has not been set explicitly.
In Jaybird 3.0.2 and higher this error will only be thrown if system property org.firebirdsql.jdbc.requireConnectionEncoding has been set to true.

To address this error, you can set the default connection character set using one of the following options:

  • Use connection property encoding (alias: lc_ctype) with a Firebird character set name.

    Use encoding=NONE for the default behavior (with some caveats, see How does character set NONE work?).

  • Use connection property charSet (alias: localEncoding) with a Java character set name.

  • Use a combination of encoding and charSet, if you want to reinterpret a Firebird character set in a Java character set other than the default mapping.

  • By providing a default Firebird character set with system property org.firebirdsql.jdbc.defaultConnectionEncoding.
    Jaybird will apply the specified character set as the default when no character set is specified in the connection properties.

    This property only supports Firebird character set names.

    Use -Dorg.firebirdsql.jdbc.defaultConnectionEncoding=NONE to revert to the default behavior (with some caveats, see How does character set NONE work?).
    With Jaybird 3.0.2 or higher, it is better to just not set system property org.firebirdsql.jdbc.requireConnectionEncoding if you want to apply NONE.

15. How can I enable the Windows «TCP Loopback Fast Path» introduced in Firebird 3.0.2?

Microsoft has deprecated the SIO_LOOPBACK_FAST_PATH and recommends not to use it.

Firebird 3.0.2 adds support for “TCP Loopback Fast Path” (SIO_LOOPBACK_FAST_PATH socket option).
This is available in Windows 8 / Windows Server 2012 and higher.
This feature enables performance optimizations when connecting through localhost (127.0.0.1 / ::1).
It requires support on both client and server side.

Java support for «TCP Loopback Fast Path» was introduced in Java 8 update 60, it can be enabled by specifying the system property jdk.net.useFastTcpLoopback with value true (e.g. specify -Djdk.net.useFastTcpLoopback=true in your Java commandline).

Unfortunately, Java only has an ‘all-or-nothing’ support for the “TCP Loopback Fast Path”, so Jaybird cannot enable this for you: you must specify this property on JVM startup.
On the other hand, this has the benefit that this works for all Jaybird versions, as long as you use Java 8 update 60 or higher (and Firebird 3.0.2 or higher).

16. Common connection errors

16.1. Your user name and password are not defined. Ask your database administrator to set up a Firebird login. (335544472)

This error means that the user does not exist, or that the specified password is not correct.

When connecting to Firebird 3.0 and higher, this error can also mean that the user does exist (with that password), but not for the authentication plugins tried for this connection.

For example, Jaybird 2.2.x and earlier only support legacy authentication, if you try to log in as a user created for SRP authentication, you will get the same error.

16.2. Incompatible wire encryption levels requested on client and server (335545064)

With Jaybird 3.0.0 — 3.0.3 connecting to Firebird 3.0 or higher, this usually means that the setting WireCrypt is set to its (default) value of Required.

Upgrade to Jaybird 3.0.4 or higher, or relax this setting (in firebird.conf) to WireCrypt = Enabled.

With Jaybird 3.0.4 or higher, or Jaybird 4, this error means that you have requested a connection with a mismatch in encryption settings.
For example, you specified connection property wireCrypt=required while Firebird is set to WireCrypt = Disabled (or vice versa).

16.3. connection rejected by remote interface (335544421)

In general this error means that Jaybird requested a connection with properties not supported by Firebird.
It can have other causes than described below.

16.3.1. Cause: username or password is null

With Jaybird 3 and Jaybird 4 connecting to Firebird 3.0 or higher, leaving username or password null will lead to Jaybird not trying any authentication plugin, and as a result Firebird will reject the connection.

With Firebird 2.5 and earlier, or Jaybird 2.2 or earlier, or Jaybird 5 or higher, this situation will yield error “Your user name and password are not defined. Ask your database administrator to set up a Firebird login.”

16.3.2. Cause: wirecrypt required

With Jaybird 2.2.x connecting to Firebird 3.0 or higher, this usually means that the setting WireCrypt is set to its (default) value of Required.

Relax this setting (in firebird.conf) to WireCrypt = Enabled.

Make sure you check the other settings mentioned in that article, otherwise you’ll get the next error.

16.4. Error occurred during login, please check server firebird.log for details (335545106)

If the logging contains something like

SERVER	Sat Oct 28 10:07:26 2017
	Authentication error
	No matching plugins on server

With Jaybird 2.2 connecting to Firebird 3.0 or higher, this means that the setting AuthServer does not include the Legacy_Auth plugin.

Enable Legacy_Auth (in firebird.conf) by adding this value to the property AuthServer, for example: AuthServer = Srp, Legacy_Auth.

With Jaybird 4 and higher, this can also mean that none of the default authentication plugins, or those specified using connection property authPlugins, are listed in the AuthServer setting.
Either revise the Firebird configuration, or explicitly configure connection property authPlugins with authentication plugins that are configured in Firebird.

16.5. Encryption key did not meet algorithm requirements of Symmetric/Arc4 (337248282)

If the exception cause is java.security.InvalidKeyException: Illegal key size or default parameters, this means that your Java installation applies a security policy that does not allow ARCFOUR with a 160 bit encryption key.

If wireCrypt=ENABLED (the default), this is just logged as a warning.
The connection will succeed, but it does mean that the connection will not be encrypted.
If wireCrypt=REQUIRED, this is thrown as an exception, and the connection will fail.

This could indicate that your Java version applies the limited strength Cryptographic Jurisdiction Policy (this was the default in Java 8 Update 152 and earlier), or has been explicitly configured to apply the limited policy, or has a custom security policy to restrict the cryptographic key size.

Solutions and workarounds:

  • Apply the unlimited Cryptographic Jurisdiction Policy, see this Stack Overflow answer

  • Relax your custom security policy to allow 160 bit keys for ARCFOUR

  • Disable wire encryption for Firebird by setting WireCrypt = Disabled in firebird.conf

  • Set wireCrypt=DISABLED in the connection properties

Be aware that the first two options may have legal implications depending on the local law in your country regarding cryptography.

JDBC Support

17. How much of JDBC is supported by Jaybird?

WARNING The information in this section is not 100% up-to-date

Jaybird 4 follows the JDBC 4.3 specification with some features and methods not implemented as they are not supported by Firebird.

Implemented features:

  • Most useful JDBC functionality (“useful” in the opinion of the developers).

  • XA transactions with true two phase commit when used via javax.sql.XADataSource implementation org.firebirdsql.ds.FBXADataSource.

  • ObjectFactory implementation org.firebirdsql.ds.DataSourceFactory for use in environments with JNDI but no TransactionManager.

  • DataSource implementation org.firebirdsql.ds.FBSimpleDataSource (no pooling).

  • ConnectionPoolDataSource implementation org.firebirdsql.ds.FBConnectionPoolDataSource (please be aware, contrary to suggested by the naming, this does not provide connection pooling, this is intended as a factory of connections for use by a connection pool, e.g. as provided by a Java EE/Jakarta EE application server)

  • Complete access to all Firebird database parameter block and transaction parameter block settings.

  • JMX mbean for database management (so far just database create and drop).

18. What parts of JDBC are NOT supported by Jaybird?

WARNING The information in this section is outdated

The following optional features are NOT supported:

The following optional features and the methods that support it are not implemented:

  • Ref and Array types.

    • java.sql.PreparedStatement

      • setRef(int i, Ref x)

      • setArray(int i, Array x)

    • java.sql.ResultSet

      • getArray(int i)

      • getArray(String columnName)

      • getRef(int i)

      • getRef(String columnName)

  • User Defined Types/Type Maps.

    • java.sql.ResultSet

      • getObject(int i, java.util.Map map)

      • getObject(String columnName, java.util.Map map)

    • java.sql.Connection

      • getTypeMap()

      • setTypeMap(java.util.Map map)

Excluding the unsupported features, the following methods are not yet implemented:

  • java.sql.Blob

    • getBytes(long pos, int length)

    • position(byte pattern[], long start)

    • position(Blob pattern, long start)

    • getBinaryStream(long pos, long length)

    • truncate(long len)

    • Methods with a position (pos) parameter with a value greater than 1

  • java.sql.Clob

    • length()

    • truncate(long len)

    • position(String searchstr, long start)

    • position(Clob searchstr, long start)

    • getCharacterStream(long pos, long length)

    • Methods with a position (pos) parameter with a value greater than 1

The following methods are implemented, but do not work as expected:

  • java.sql.Statement

    • get/setMaxFieldSize does nothing

    • get/setQueryTimeout supported since Jaybird 4 with Firebird 4.0 and higher

  • java.sql.PreparedStatement

    • setObject(index,object,type) This method is implemented but behaves as setObject(index,object)

    • setObject(index,object,type,scale) This method is implemented but behaves as setObject(index,object)

  • java.sql.CallableStatement

    • getBigDecimal(index,scale) This method is implemented but behaves as getBigDecimal(index).
      The method is deprecated, and we suggest using getBigDecimal(index) and adjust the scale of the returned BigDecimal using BigDecimal.setScale(newScale,roundingMode)

  • java.sql.ResultSetMetaData

    • isReadOnly(i) always returns false

    • isWritable(i) always returns true

    • isDefinitivelyWritable(i) always returns true

  • java.sql.ResultSet

    • getBigDecimal(index,scale) This method is implemented but behaves as getBigDecimal(index).
      The method is deprecated, and we suggest using getBigDecimal(index) and adjust the scale of the returned BigDecimal using BigDecimal.setScale(newScale,roundingMode)

Features

19. Does Jaybird support connection pooling?

Jaybird itself no longer provides connection pooling.
Earlier versions had a DataSource implementation with connection pooling, but this implementation had severe bugs.
This implementation (and all other classes in org.firebirdsql.pool) was deprecated in Jaybird 2.2 and dropped in Jaybird 3.

Jaybird provides a basic DataSource implementation and a ConnectionPoolDataSource implementation.
Contrary to its name the latter does not provide a connection pool, but is intended to be used by a connection pool (as implemented in an application server) to create connections for the connection pool.

If your application is built on a Java EE/Jakarta EE application server, we suggest you use the connection pooling provided by the application server using the javax.sql.ConnectionPoolDataSource implementation org.firebirdsql.ds.FBConnectionPoolDataSource, or using the javax.sql.XADataSource implementation org.firebirdsql.ds.FBXADataSource.

If you develop standalone applications, or you use an application server without connection pooling, we suggest you use third-party libraries like:

  • HikariCP

  • c3p0

  • Apache DBCP

Compatibility notes

20. Wildfly

The minimal module.xml to use Jaybird 3 under Wildfly is:

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="org.firebirdsql">
  <resources>
    <resource-root path="jaybird-3.0.x.jar"/>
  </resources>
  <dependencies>
    <module name="javax.api"/>
    <module name="javax.transaction.api"/>
    <module name="javax.resource.api"/>
  </dependencies>
</module>

With Jaybird 3.0.4 and higher for Java 7 (but not Java 8!) in Wildfly (or JBoss), you will need to add the module javax.xml.bind.api to your module:

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="org.firebirdsql">
  <resources>
    <resource-root path="jaybird-3.0.x.jar"/>
  </resources>
  <dependencies>
    <module name="javax.api"/>
    <module name="javax.transaction.api"/>
    <module name="javax.resource.api"/>
    <module name="javax.xml.bind.api"/> <!-- Add this -->
  </dependencies>
</module>

Alternatively, use Jaybird for Java 8 (or higher).

Здравствуйте. Пытаюсь освоить работу с СУБД firebird из под java. Написал такой вот код, который должен по-идее подключиться к БД:

Java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Properties;
 
public class Main {
    public static void main(String[] args) {
        try {
            String url = "jdbc:firebirdsql://localhost/3050//home/bond12/1/1.fdb";
 
            Properties props = new Properties();
            props.setProperty("user", "sysdba");
            props.setProperty("password", "1234");
            props.setProperty("encoding", "UTF8");
 
            Class.forName("org.firebirdsql.jdbc.FBDriver");
            try {
                Connection connection = DriverManager.getConnection(url, props);
            } catch (SQLException e) {
 
                e.printStackTrace();
            }
        } catch (ClassNotFoundException e) {
 
            e.printStackTrace();
        }
        return;
    }
}

При попытке его выполнить вываливаются следующие ошибки:

Код

java.sql.SQLNonTransientConnectionException: Unable to complete network request to host "localhost". [SQLState:08006, ISC error code:335544721]
	at org.firebirdsql.gds.ng.FbExceptionBuilder$Type$5.createSQLException(FbExceptionBuilder.java:598)
	at org.firebirdsql.gds.ng.FbExceptionBuilder$ExceptionInformation.toSQLException(FbExceptionBuilder.java:492)
	at org.firebirdsql.gds.ng.FbExceptionBuilder.toSQLException(FbExceptionBuilder.java:223)
	at org.firebirdsql.gds.ng.wire.WireConnection.socketConnect(WireConnection.java:236)
	at org.firebirdsql.gds.ng.wire.FbWireDatabaseFactory.performConnect(FbWireDatabaseFactory.java:50)
	at org.firebirdsql.gds.ng.wire.FbWireDatabaseFactory.connect(FbWireDatabaseFactory.java:39)
	at org.firebirdsql.gds.ng.wire.FbWireDatabaseFactory.connect(FbWireDatabaseFactory.java:32)
	at org.firebirdsql.jca.FBManagedConnection.<init>(FBManagedConnection.java:145)
	at org.firebirdsql.jca.FBManagedConnectionFactory.createManagedConnection(FBManagedConnectionFactory.java:599)
	at org.firebirdsql.jca.FBStandAloneConnectionManager.allocateConnection(FBStandAloneConnectionManager.java:65)
	at org.firebirdsql.jdbc.FBDataSource.getConnection(FBDataSource.java:109)
	at org.firebirdsql.jdbc.FBDriver.connect(FBDriver.java:114)
	at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677)
	at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:189)
	at Main.main(Main.java:26)
Caused by: java.net.ConnectException: В соединении отказано (Connection refused)
	at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
	at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
	at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403)
	at java.base/java.net.Socket.connect(Socket.java:609)
	at org.firebirdsql.gds.ng.wire.WireConnection.socketConnect(WireConnection.java:226)
	... 11 more

При этом: База данных 1.fdb существует по пути: /home/bond12/1/
Для SYSDBA задан пароль 1234, с помощью isql-fb всё нормально работает.

В чём проблема, я не понимаю. Предполагаю, что проблема в написании адреса для подключения. Подскажите, пожалуйста, в чём проблема.

Добавлено через 3 часа 30 минут
Прошлый пример был опробован в линуксе. Попробовал потыкать в Windows, код

Java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Properties;
 
public class Main {
    public static void main(String[] args) {
        try {
            String url = "jdbc:firebirdsql://localhost:3050/c:/1/TESTDB.fdb";
 
            Properties props = new Properties();
            props.setProperty("user", "sysdba");
            props.setProperty("password", "1234");
            props.setProperty("encoding", "UTF8");
 
            Class.forName("org.firebirdsql.jdbc.FBDriver");
            try {
                Connection connection = DriverManager.getConnection(url, props);
            } catch (SQLException e) {
 
                e.printStackTrace();
            }
        } catch (ClassNotFoundException e) {
 
            e.printStackTrace();
        }
        return;
    }
}

выполняется без ошибок. Отсюда следует, что проблема с подключением к СУБД в линуксе. Завставить работать её под линуксом необходимо, поэтому вопрос всё ещё в силе. На одном форуме нашёл следующие сообщения:

Код

Сталкнулся впервые с такой проблемой в SQuirreL SQL Client при попытки приконектиться к Firebird получал ошибку "Unable to complete network request to host "localhost"." тогда у меня стояла ОС Gentoo затем на Fedora 11.

Выход из ситуации оказался то идиотизма прост. В файле /etc/hosts у меня было следующее:

127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6

добавив имя хоста и все заработало:

127.0.0.1 localhost.localdomain localhost <you_host_name>.<you_domain> <you_host_name>
::1 localhost6.localdomain6 localhost6

И у одного человека даже заработало, после того, как он изменил hosts:
<цитата>

Код

Ура заработала!!!
В файле /etc/hosts была строка:
127.0.0.1 localhost
После изменения заработало. Сделал так:
127.0.0.1 localhost adminu.dindust adminu

Может быть у меня проблема решится похожим образом, но я не понимаю, что они сделали в файле hosts. Можете объяснить кто-нибудь?
Не работает, получается, только через java. flamerobin и isql с бд работают нормально. Как я понял, это именно проблема с подключением к СУБД, т.к. поэкспериментировав в windows при вводе неправильного пароля или неправильного файлового пути возникают совсем другие ошибки.

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь

У меня было 2 сервера, которые использовали Firebird 2.5. У каждого из серверов была отдельная база данных, и один из них подключался к другому для получения некоторых данных. Один из серверов перешел на Firebird 3.0 и теперь не может подключиться к серверу 2.5. В нем указано, что мое имя пользователя или пароль неверны. Я подключился к серверу 2.5 с учетными данными, и они в порядке.

Для получения данных я использовал оператор Execute [STATEMENT] на внешнем источнике данных [SERVER] в качестве пароля пользователя [USER] [PASSWORD].

В версии 2.5 больше баз данных, и обновить ее до версии 3.0 будет непросто.

У кого-нибудь была эта проблема?

1 ответ

Лучший ответ

Я провел некоторое тестирование с Firebird 2.5 (2.5.8) и Firebird 3 (3.0.4) на том же сервере с разными портами, используя следующую простую инструкцию (и изменяя некоторые части в зависимости от того, что я тестирую), чтобы увидеть, что типа сбоев соединения, которые я могу произвести.

set term #;
execute block returns (tblname char(31))
as
begin
  for execute statement 'select rdb$relation_name from rdb$relations where coalesce(rdb$system_flag, 0) = 0' 
    on external data source 'localhost/3051:D:datadbtestdatabase.fdb' 
      as user 'sysdba' password 'masterkey'
    into tblname
  do suspend;
end#
set term ;#

От Firebird 3 до Firebird 2.5

Используя этот оператор, я могу получить ошибку «Ваше имя пользователя и пароль не определены». от Firebird 3 до 2.5 в следующих ситуациях:

  1. Firebird 3 имеет конфигурацию AuthClient 1 , которая не включает Legacy_Auth. Firebird 3 не может аутентифицироваться в Firebird 2.5, поскольку Firebird 2.5 знает только об устаревшем механизме аутентификации.

    Чтобы исправить это, добавьте Legacy_Auth в настройку AuthClient в firebird.conf сервера Firebird 3 (например, установите его на AuthClient = Srp, Legacy_Auth) и перезапустите сервер.

    Скорее всего, это ваша проблема.

  2. Отсутствие указания имени пользователя и пароля (т.е. исключение as user 'sysdba' password 'masterkey' из execute statement). Вероятно, это связано с различием в механизмах аутентификации, поскольку Firebird не знает фактический пароль с протоколом SRP и поэтому не сможет аутентифицироваться на другом сервере.

    Это можно исправить, указав имя пользователя и пароль.

От Firebird 2.5 до Firebird 3

В обратном направлении (Firebird 2.5 до 3) я не могу установить соединение в следующих ситуациях:

  1. Аутентификация с использованием имени пользователя и пароля, который существует только как пользователь Srp. Это приводит к ошибке «Ваше имя пользователя и пароль не определены» , поскольку Firebird 2.5 поддерживает только устаревшую аутентификацию и в результате может аутентифицироваться только с теми пользователями, которые существуют для плагина Legacy_UserManager в Firebird 3.

    Создайте пользователя (с тем же или другим именем) для плагина Legacy_UserManager:

    create user theuser password 'thepassword' using plugin Legacy_UserManager;
    commit;
    

    Если это приводит к ошибке «Отсутствует запрошенный плагин управления» , вам необходимо отредактировать Firebird 3 firebird.conf и добавить Legacy_UserManager в настройку UserManager (например, установить на UserManager = Srp, Legacy_UserManager; по умолчанию только Srp) и перезапустите Firebird.

    В качестве SYSDBA вы можете проверить на сервере Firebird 3, для какого плагина (или плагинов!) Существует пользователь, выполнив

    select SEC$USER_NAME, SEC$PLUGIN 
    from SEC$USERS
    
  2. Firebird 3 имеет настройку WireCrypt = Required (это значение по умолчанию!). Это вызывает ошибку «соединение отклонено удаленным интерфейсом» .

    Чтобы исправить это, установите WireCrypt = Enabled в firebird.conf сервера Firebird 3 и перезапустите сервер.

  3. Отсутствие указания имени пользователя и пароля (т.е. исключение as user 'sysdba' password 'masterkey' из execute statement). Это вызывает ошибку «неизвестная ошибка ISC 335545106» (фактическое сообщение — «Ошибка при входе в систему, пожалуйста, проверьте сервер firebird.log для подробностей» , если файл сообщений Firebird 3 used), где в журнале Firebird 3 указано «Нет подходящих подключаемых модулей на сервере» , вероятно, это связано с различием в механизмах аутентификации.

    Это можно исправить, указав имя пользователя и пароль.

  4. Firebird 3 имеет конфигурацию AuthServer, которая не включает Legacy_Auth (по умолчанию используется только Srp!). Это также приводит к ошибке «неизвестная ошибка ISC 335545106» (фактическое сообщение — «Ошибка при входе в систему, пожалуйста, проверьте сервер firebird.log для подробностей» , если файл сообщений Firebird 3 использовано), где в журнале Firebird 3 написано «На сервере нет соответствующих плагинов» .

    Чтобы исправить это, добавьте Legacy_Auth в настройку AuthServer в firebird.conf сервера Firebird 3 (например, установите его на AuthServer = Srp, Legacy_Auth) и перезапустите сервер.

И, конечно же, в обоих направлениях ошибка «Ваше имя пользователя и пароль не определены» также может быть вызвана использованием несуществующих пользователей или неправильных паролей.


1. Здесь важна настройка AuthClient, поскольку сервер действует как клиент при выполнении execute statement ... on external data source ...


3

Mark Rotteveel
14 Фев 2019 в 20:49

Я провел некоторое тестирование с Firebird 2.5 (2.5.8) и Firebird 3 (3.0.4) на одном сервере с разными портами, используя следующий простой оператор (и изменив некоторые части в зависимости от того, что я тестирую), чтобы увидеть, что вид сбоев соединения, которые я могу произвести.

set term #;
execute block returns (tblname char(31))
as
begin
  for execute statement 'select rdb$relation_name from rdb$relations where coalesce(rdb$system_flag, 0) = 0' 
    on external data source 'localhost/3051:D:datadbtestdatabase.fdb' 
      as user 'sysdba' password 'masterkey'
    into tblname
  do suspend;
end#
set term ;#

От Firebird 3 до Firebird 2.5

Используя этот оператор, я могу получить ошибку «Ваше имя пользователя и пароль не определены». от Firebird 3 до 2.5 в следующих ситуациях:

  1. Firebird 3 имеет конфигурацию AuthClient1, которая не включает Legacy_Auth. Firebird 3 не может аутентифицироваться в Firebird 2.5, поскольку Firebird 2.5 знает только об унаследованном механизме аутентификации.

    Чтобы исправить это, добавьте Legacy_Auth к параметру AuthClient в firebird.conf сервера Firebird 3 (например, установите для него значение AuthClient = Srp, Legacy_Auth) и перезапустите сервер.

    Этот пункт, скорее всего, ваша проблема.

  2. Не указывать имя пользователя и пароль (т.е. оставлять as user ‘sysdba’ password ‘masterkey’ вне execute statement). Вероятно, это связано с различием в механизмах аутентификации, поскольку Firebird не знает фактический пароль для протокола SRP и, следовательно, не сможет аутентифицироваться на другом сервере.

    Указание имени пользователя и пароля исправляет это.

От Firebird 2.5 до Firebird 3

В обратном направлении (Firebird с 2.5 по 3) я не могу установить соединение в следующих ситуациях:

  1. Аутентификация с именем пользователя и паролем, которые существуют только как пользователь Srp. Это приводит к ошибке «Ваше имя пользователя и пароль не определены»., так как Firebird 2.5 поддерживает только устаревшую аутентификацию и в результате может аутентифицироваться только с пользователями, которые существуют для подключаемого модуля Legacy_UserManager в Firebird 3.

    Создайте пользователя (с таким же или другим именем) для плагина Legacy_UserManager:

    create user theuser password 'thepassword' using plugin Legacy_UserManager;
    commit;
    

    Если это приводит к ошибке «Отсутствует запрошенный плагин управления», вам необходимо отредактировать Firebird 3 firebird.conf и добавить Legacy_UserManager к настройке UserManager (например, установить на UserManager = Srp, Legacy_UserManager; по умолчанию только Srp) и перезапустить Firebird.

    Как SYSDBA, вы можете проверить на сервере Firebird 3, для какого плагина (или плагинов!) существует пользователь, выполнив

    select SEC$USER_NAME, SEC$PLUGIN 
    from SEC$USERS
    
  2. В Firebird 3 есть настройка WireCrypt = Required (по умолчанию!). Это приводит к ошибке «соединение отклонено удаленным интерфейсом».

    Чтобы это исправить, установите WireCrypt = Enabled в firebird.conf сервера Firebird 3 и перезапустите сервер.

  3. Не указывать имя пользователя и пароль (т.е. оставлять as user ‘sysdba’ password ‘masterkey’ вне execute statement). Это приводит к ошибке «неизвестная ошибка ISC 335545106» (фактическое сообщение «Произошла ошибка при входе в систему, пожалуйста, проверьте сервер firebird.log для получения подробной информации», если используется файл сообщений Firebird 3), где в журнале Firebird 3 указано «Нет подходящих плагинов на сервере», это, вероятно, связано с различием в механизмах аутентификации.

    Указание имени пользователя и пароля исправляет это.

  4. Firebird 3 имеет конфигурацию AuthServer, которая не включает Legacy_Auth (по умолчанию только Srp!). Это также приводит к ошибке «неизвестная ошибка ISC 335545106» (фактическое сообщение «Произошла ошибка при входе в систему, пожалуйста, проверьте сервер firebird.log для получения подробной информации», если используется файл сообщений Firebird 3), где журнал Firebird 3 говорит «Нет подходящих плагинов на сервере».

    Чтобы исправить это, добавьте Legacy_Auth к параметру AuthServer в firebird.conf сервера Firebird 3 (например, установите для него значение AuthServer = Srp, Legacy_Auth) и перезапустите сервер.

И, конечно же, в обе стороны ошибка «Ваше имя пользователя и пароль не определены». также может быть вызвана использованием несуществующих пользователей или неверных паролей.


1. The setting AuthClient is relevant here as the server is acting as a client when executing an execute statement … on external data source …

Понравилась статья? Поделить с друзьями:
  • Firebird connect error 10061
  • Flash vendor error
  • Firebird authentication error no matching plugins on server
  • Flash userdata error
  • Firebase authentication error