I am trying to connect to a firebird db using the jaybird jdbc driver. Firebird is running under ubuntu. I have created a simple database located under /tmp/hellofb.fdb (yeah not the best place, just for testing). I am running firebird superserver 3.0. The firebird service is up and running sudo service firbird3.0 status
:
firebird3.0.service - Firebird Database Server ( SuperServer )
Loaded: loaded (/lib/systemd/system/firebird3.0.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2017-10-25 22:40:53 CEST; 25min ago
Process: 23411 ExecStart=/usr/sbin/fbguard -pidfile /run/firebird3.0/default.pid -daemon -forever (code=exited, status=0/SUCC
Main PID: 23412 (fbguard)
Tasks: 4 (limit: 4915)
CGroup: /system.slice/firebird3.0.service
├─23412 /usr/sbin/fbguard -pidfile /run/firebird3.0/default.pid -daemon -forever
└─23413 /usr/sbin/firebird
Okt 25 22:40:53 XPS-L322X systemd[1]: Starting Firebird Database Server ( SuperServer )...
Okt 25 22:40:53 XPS-L322X systemd[1]: Started Firebird Database Server ( SuperServer ).
My spring boot application.properties is given by:
spring.datasource.url:jdbc:firebirdsql://localhost:3050//tmp/hellofb.fdb
spring.datasource.driverClassName:org.firebirdsql.jdbc.FBDriver
However, when I try to connect to the database, I get the following exception:
org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544421. connection rejected by remote interface
I have tried all possible permutations given by the jaybird FAQ, I am running out of options. Any help would be greatly appreciated!
Note: I tried to connect to the databse using flamerobin and everything works just fine
Given you haven't provided the information I asked for in the comments, I have to guess you are using Firebird 3 with Jaybird 2.2.x based on the described behavior.
The error connection rejected by remote interface can also occur under other conditions than described below.
Firebird 3 introduces a number of new security features that are enabled by default, but are not supported by Jaybird 2.2. To allow Jaybird 2.2 to connect to Firebird 3 you need to relax some of those settings.
To allow Jaybird 2.2.x to connect, you need to change the following settings in firebird.conf
(and restart Firebird after changing the setting):
Relax the WireCrypt
setting from its default of Required
to Enabled
:
WireCrypt = Enabled
Enable support for the legacy authentication protocol:
AuthServer = Srp, Legacy_Auth
You then need to make sure the user you want to use for connecting to Firebird is created with the legacy usermanager by enabling support for the legacy usermanager:
UserManager = Srp, Legacy_UserManager
Restart Firebird to apply these settings, and then - in Flamerobin - with a SYSDBA account (or user with role RDB$ADMIN), create the required user:
CREATE USER youruser PASSWORD 'yourpasw' USING PLUGIN Legacy_UserManager
Alternatively you could upgrade to Jaybird 3.0.4 or higher, which supports the Srp
authentication protocol and wire protocol encryption.
These settings are described in more detail on our wiki in article Jaybird and Firebird 3. This information was absent from our FAQ, I have now added it under connection rejected by remote interface (335544421).
With Jaybird 3 or higher and Firebird 3 or higher, this error can be the result of not providing a username or password. The absence of a user name or password causes Jaybird to not try any authentication plugin. This results in Firebird rejecting the connection attempt as at least one authentication attempt should be done.
Since Jaybird 6, Jaybird by default no longer attempts to connect to unsupported Firebird versions (i.e. for Jaybird 6, Firebird 2.5 and older).
The proper solution would be to upgrade to a supported Firebird version.
However, using the native protocol (i.e. jdbc:firebird:native:...
) older versions can still be connected to, and Jaybird's default "pure Java" implementation can be instructed to connect to older versions if an implementation of a wire protocol version supported by the target server is available (which for Jaybird 6 is still the case, but those might get removed in future versions), with the connection property enableProtocol
(either using enableProtocol=*
or a comma-separated list of unsupported protocol versions, e.g enableProtocol=10,11,12
.
Keep in mind, given Firebird 2.5 and older are not supported, it is not guaranteed that Jaybird will work correctly on those versions, and especially things like DatabaseMetaData
may fail if they use functions or features not supported by the older Firebird versions.