The first alpha version of Firebird 3 was just released, see "Firebird 3.0 Alpha 1 release is available for testing". This article describes how to use Firebird 3.0 (alpha 1) with Jaybird 2.2.x and earlier.
Firebird 3 introduces a new authentication mechanism, combined with wire protocol encryption. This new authentication mechanism (SRP) is not supported by Jaybird 2.2.x and earlier when you use the pure java wire protocol (the default). We plan to provide support in the upcoming Jaybird 2.3 release (which might get renamed to Jaybird 3.0).
For the pure java wire protocol to authenticate to Firebird 3 you need to enable legacy authentication and correctly setup your users.
Setting up legacy authentication for Firebird 3 requires modifying the
firebird.conf by adding (or modifying) the line with
AuthServer = :
AuthServer = Srp, Win_Sspi, Legacy_Auth
Restart the Firebird service after you have saved the file.
Srp is the default new authentication,
Win_Sspi is for the trusted Windows authentication, and
Legacy_Auth enables the legacy authentication mechanism of Firebird 2.5 and earlier.
By default users created through the services API,
gsec or another way will be setup for
Srp, these users don’t exist for the legacy authentication and trying to authenticate will result in the Exception:
org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544472. Your user name and password are not defined. Ask your database administrator to set up a Firebird login.
To setup a user for the legacy authentication, you need to change the
UserManager in the
UserManager = Legacy_UserManager
The default value is
UserManager = Srp. You don’t need to restart the Firebird service after changing this if you are going to use
gsec (TODO: Also for services API?).
Next you need to create the user (even if it already exists for
Srp), for example to create a user
jaybird with password
> gsec -user sysdba -password masterkey GSEC> add jaybird -pw jdbc
After doing this you should be able to connect to Firebird 3 with Jaybird 2.2.3. I’d suggest to revert the
UserManager setting in
firebird.conf to its default after you have set up the users.
(TODO: Test if
jdbc:firebirdsql:native does work)
Firebird 3 introduces a few new datatypes.
Firebird 3 adds the
BOOLEAN datatype (sqltype 32764/32765). This datatype is currently not supported by Jaybird. A snapshot version of 2.2.4 with
BOOLEAN support is available for testing. See snapshot for more information.
In Jaybird 2.2.3 and earlier, using boolean values (in select, insert, etc) of this types will yield the following exception:
Exception in thread "main" org.firebirdsql.jdbc.field.TypeConversionException: SQL type for this field is not yet supported. at org.firebirdsql.jdbc.field.FBField.createException(FBField.java:186) at org.firebirdsql.jdbc.field.FBField.createField(FBField.java:468) at org.firebirdsql.jdbc.field.FBField.createField(FBField.java:379) at org.firebirdsql.jdbc.AbstractResultSet.prepareVars(AbstractResultSet.java:200) at org.firebirdsql.jdbc.AbstractResultSet.<init>(AbstractResultSet.java:144) at org.firebirdsql.jdbc.FBResultSet.<init>(FBResultSet.java:46) at org.firebirdsql.jdbc.AbstractStatement.getResultSet(AbstractStatement.java:913) at org.firebirdsql.jdbc.AbstractStatement.getResultSet(AbstractStatement.java:894) at org.firebirdsql.jdbc.AbstractStatement.executeQuery(AbstractStatement.java:225)
A workaround is to wrap the field in an
SELECT IIF(boolvalue, 1, 0) AS boolvalue FROM booltable
Or for insert, use an expression with a boolean result in the value list:
INSERT INTO booltable(id, boolvalue) VALUES (?, 1 = ?)
This works because the second parameter will be identified as an integer, and when you use
setBoolean() on the
PreparedStatement, it will use
Firebird 3.0 introduces an autoincrement field (
<datatype> GENERATED BY DEFAULT AS IDENTITY). Jaybird 2.2.x does not have identity support, in other words it will be handled like any other
<datatype> NOT NULL field. For example in
DatabaseMetaData.getColumns() will not report
YES for the column
IS_AUTOINCREMENT (instead it reports empty string, meaning “it cannot be determined whether the column is auto incremented”).
Other operations, including retrieving generated keys, will work for this column, just as it works for normal columns.
Contrary to Firebird 2.5 and earlier, the value set using
Connection.setClientInfo(String, String) is padded with spaces. This is a bug in Firebird 3.0 alpha 1. See CORE-4156
CONCUR_UPDATABLE ResultSets, the use of
refreshRow() for queries to tables without a primary key doesn’t work. No update is performed and the refresh throws an SQLException “No rows could be fetched.”. Jaybird uses the
RDB$DB_KEY in these situations. This issue is still under investigation.