14. Firebird 2.5.4
We will now address the port to Firebird 2.5.4 of what was done with Oracle.
![]() |
14.1. Setting up the working environment
14.1.1. Eclipse environment
We will be working with the following Eclipse environment:
![]() |
The Firebird projects listed above can be found in the folder [<examples>/spring-database-config\firebird\eclipse].
Note: Press [Alt-F5] to regenerate all Maven projects.
14.1.2. Generating the databases
As we did with Oracle, DB2, and SQL Server, we will need to install the Firebird JDBC driver in the local Maven repository.
![]() |
The [install.bat] file contains the following code:
"%M2_HOME%\bin\mvn.bat" install:install-file -Dfile=jaybird-2.2.7.jar -Dpackaging=jar -DgroupId=org.firebirdsql.jdbc -DartifactId=jaybird -Dversion=2.2.7
where [%M2-HOME%] is the Maven installation directory (see section 23.2). After this installation, the Firebird JDBC driver can be referenced in the [pom.xml] files using the following dependency:
<dependency>
<groupId>org.firebirdsql.jdbc</groupId>
<artifactId>jaybird</artifactId>
<version>2.2.7</version>
</dependency>
From here on, connections to Firebird databases are made using the credentials [sysdba / masterkey]. Start Firebird and its client [IBManager] (see section 23.10). Firebird databases are unique in that they are encapsulated in a single file.
![]() | ![]() |
![]() |
- In [1], the file can be found at [<examples>\spring-database-config\firebird\databases\DBPRODUITS.GDB];
![]() |
- As with Oracle, primary keys are generated using sequences.
We proceed in the same way to load the [dbproduitscategories] database, which can be found in [<examples>\spring-database-config\firebird\databases\DBPRODUITSCATEGORIES.GDB]
![]() |
Now, run the configurations:
- [spring-jdbc-generic-01.IntroJdbc01];
- [spring-jdbc-generic-01.IntroJdbc02];
- [spring-jdbc-generic-03.JUnitTestDao1];
- [spring-jdbc-generic-03.JUnitTestDao2];
- [spring-jdbc-generic-04.JUnitTestDao];
- [spring-jpa-generic-JUnitTestDao-openjpa];
They must all pass.
14.2. Configuring the JDBC Layer
![]() | ![]() |
The [firebird-config-jdbc] project configures the [JDBC] layer of the following test architecture:
![]() |
The project is analogous to the [oracle-config-jdbc] configuration project for the JDBC layer of the MySQL DBMS (see Section 10.2). We present only the changes:
The [pom.xml] file imports the Firebird JDBC driver:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>dvp.spring.database</groupId>
<artifactId>generic-config-jdbc</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>generic jdbc configuration</name>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.3.RELEASE</version>
</parent>
<dependencies>
<!-- variable dependencies ********************************************** -->
<!-- JDBC driver for the DBMS -->
<dependency>
<groupId>org.firebirdsql.jdbc</groupId>
<artifactId>jaybird</artifactId>
<version>2.2.7</version>
</dependency>
<!-- required for the Firebird driver -->
<dependency>
<groupId>javax.resource</groupId>
<artifactId>connector-api</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr-runtime</artifactId>
<version>3.5.2</version>
</dependency>
<!-- constant dependencies ********************************************** -->
...
</dependencies>
...
</project>
- lines 18–22: the Firebird JDBC driver;
- lines 24–33: the dependencies required for the Firebird JDBC driver;
The second change is in the [ConfigJdbc] class, which defines the database credentials:
// connection parameters
public final static String DRIVER_CLASSNAME = "org.firebirdsql.jdbc.FBDriver";
public final static String URL_DBPRODUITS = "jdbc:firebirdsql:localhost/3050:<examples>/SPRING-DATABASE-CONFIG/FIREBIRD/DATABASES/DBPRODUITS.GDB";
public final static String USER_DBPRODUITS = "sysdba";
public final static String PASSWD_DBPRODUCTS = "masterkey";
public final static String PRODUCT_CATEGORIES_DB_URL = "jdbc:firebirdsql:localhost/3050:<examples>/SPRING-DATABASE-CONFIG/FIREBIRD/DATABASES/PRODUCT_CATEGORIES_DB.GDB";
public final static String USER_DBPRODUCTSCATEGORIES = "sysdba";
public final static String PASSWD_DBPRODUITSCATEGORIES = "masterkey";
- Lines 3 and 6: You must enter the exact paths for both databases;
The third modification that can be made is to the maximum number of parameters that a [PreparedStatement] can support:
// maximum number of parameters for a [PreparedStatement]
public final static int MAX_PREPAREDSTATEMENT_PARAMETERS = 1000;
The [JUnitTestPushTheLimits] test generates SQL statements for 5,000 products, which will generate [PreparedStatement] objects with 5,000 parameters. MySQL supported this value. Firebird did not.
The fourth change concerns a reserved word in Firebird-config-jdbc: PASSWORD. The [USERS.PASSWORD] column has therefore been renamed [USERS.PASSWD]:
public final static String TAB_USERS_PASSWORD = "PASSWD";
public static final String SELECT_USER_BYLOGIN = "SELECT u.ID as u_ID, u.VERSIONING as u_VERSIONING, u.NAME as u_NAME, u.LOGIN as u_LOGIN, u.PASSWD as u_PASSWORD FROM USERS u WHERE u.LOGIN= :login";
14.3. Configuring the OpenJPA JPA Layer
![]() | ![]() |
The [firebird-config-jpa-openjpa] project configures the [JPA] layer of the test architecture:
![]() |
This project is similar to the [firebird-config-jpa-openjpa] configuration project for the OpenJPA JPA layer of the Oracle DBMS (see Section 10.5). In fact, both DBMSs use sequences to generate primary keys. There is only one change to make. It is in the definition of the [jpaVendorAdapter] bean in the [ConfigJpa] class:
// the JPA provider
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
OpenJpaVendorAdapter openJpaVendorAdapter = new OpenJpaVendorAdapter();
openJpaVendorAdapter.setShowSql(false);
openJpaVendorAdapter.setDatabase(Database.DEFAULT);
openJpaVendorAdapter.setGenerateDdl(true);
return openJpaVendorAdapter;
}
- Line 6: We tell the JPA implementation that it will be working with an unrecognized DBMS. The JPA implementation will then adopt standard SQL data types.
With these changes made, the execution of the [spring-jpa-generic-JUnitTestDao-openjpa] configuration should succeed.
![]() | ![]() |
14.4. Configuring the Hibernate JPA layer
![]() | ![]() |
Note: Press [Alt-F5] to regenerate all Maven projects.
The [firebird-config-jpa-hibernate] project is analogous to the [oracle-config-jpa-hibernate] project (Section 10.4) with the same modifications that were used to port the [oracle-config-jpa-openjpa] project to the [firebird-config-jpa-openjpa] project (Section 10.4).
With these modifications in place, running the [spring-jpa-generic-JUnitTestDao-hibernate-eclipselink] configuration should succeed.
14.5. Configuring the EclipseLink JPA layer
![]() | ![]() |
Note: Press [Alt-F5] to regenerate all Maven projects.
The [firebird-config-jpa-eclipselink] project is analogous to the [oracle-config-jpa-eclipselink] (Section 10.3) with the same modifications that were used to port the [oracle-config-jpa-openjpa] project to the [firebird-config-jpa-openjpa] project (Section 10.4).
With these modifications in place, the execution of the [spring-jpa-generic-JUnitTestDao-hibernate-eclipselink] configuration should succeed.



















