No luck trying out Firebird 3.0 Today I though I'd give Firebird 3.0 a shot, but for some reason I can't seem to get it installed - at least not in a way that I can connect from a JDBC application. 

What I did was to follow this article:

http://firebird3.blogspot.com.br/2012/03/how-to-install-firebird-3.html

This is what happened:


c:\etc\Firebird30>gsec -add sysdba -pass masterkey

c:\etc\Firebird30>start firebird.exe -a -m

c:\etc\Firebird30>isql
Use CONNECT or CREATE DATABASE to specify a database
SQL> create database "localhost:c:\temp\mydbfb3.fdb" user "sysdba" password "masterkey";
Statement failed, SQLSTATE = 08006
Error reading data from the connection.
SQL>


Now creating the database "locally" works:


SQL> create database "c:\temp\mydbfb3.fdb" user "sysdba" password "masterkey";
SQL> commit;
SQL>


But in that case, when I connect from a JDBC application (still everything "localhost"), I get the error message (using sysdba/masterkey to log in)


GDS Exception. 335544472. Your user name and password are not defined. Ask your database administrator to set up a Firebird login.
Reason: Your user name and password are not defined. Ask your database administrator to set up a Firebird login.


I double-checked (more than once) that the username and password in the JDBC application is sysdba/masterkey.

From the commandline I can indeed access that newly created database:


SQL> connect 'c:\temp\mydbfb3.fdb';
Database:  'c:\temp\mydbfb3.fdb'
SQL> create table foo  (bar integer);
SQL> insert into foo values (1);
SQL> select * from foo;

         BAR
============
           1

SQL> commit;
SQL>


I'm sure I'm missing something obvious, but what?
The problem is twofold:

First Firebird 3 uses tighter security and has the old authentication mechanism disabled by default. So clients depending on older connection libraries will not work out of the box.

To allow the old authentication mechanism to work, the following setting needs to be set in firebird.conf:

AuthServer = Legacy_Auth, Srp, Win_Sspi


(be sure to remove the # prefix)

Second, the pure-java wire protocol implementation of Jaybird (the Firebird JDBC driver) uses an outdated authentication mechanism that is not supported by this Legacy_Auth option. Using Jaybird to connect to Firebird 3 at this time will only work if you use the native option (with the jdbc:firebirdsql:native: URL-prefix and jaybird2x.dll and fbclient.dll).

Addendum 1

Firebird 3 (since Alpha 1) has now also implemented the old authentication method used by Jaybird, so Jaybird will now also work without using the native library (as long as the legacy authentication is enabled, and the user has been setup with the legacy usermanager).

See also Jaybird and Firebird 3

Addendum 2

Jaybird 3 and higher support the more secure Srp authentication model out of the box, and Jaybird 3.0.4 introduced support for the wire protocol encryption. This means that it can connect to Firebird 3 without additional configuration.