2

I'm trying to connect Hibernate to firebird database, but i receive the error bellow.

My configuration in persistence.xml is:

    <property name="hibernate.connection.url" value="jdbc:firebirdsql:localhost/3050:/database.FDB"/>
    <property name="hibernate.connection.driver_class" value="org.firebirdsql.jdbc.FBDriver"/>
    <property name="hibernate.connection.username" value="SYSDBA"/>
    <property name="hibernate.connection.password" value="masterkey"/>
    <property name="hibernate.archive.autodetection" value="class"/>

    <property name="hibernate.dialect" value="org.hibernate.dialect.FirebirdDialect"/>
    <property name="hibernate.show_sql" value="true"/>
    <property name="hibernate.format_sql" value="true"/> 
    <property name="hibernate.hbm2ddl.auto" value="update"/>

In pom.xml is:

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

The error:

INFO: HHH000412: Hibernate Core {5.2.6.Final}
abr 12, 2018 1:52:25 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
abr 12, 2018 1:52:25 PM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
abr 12, 2018 1:52:25 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)
abr 12, 2018 1:52:25 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001005: using driver [org.firebirdsql.jdbc.FBDriver] at URL [jdbc:firebirdsql:localhost/3050:/database.FDB]
abr 12, 2018 1:52:25 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001001: Connection properties: {user=SYSDBA, password=****}
abr 12, 2018 1:52:25 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001003: Autocommit mode: false
abr 12, 2018 1:52:25 PM org.hibernate.engine.jdbc.connections.internal.PooledConnections <init>
INFO: HHH000115: Hibernate connection pool size: 20 (min=1)
abr 12, 2018 1:52:25 PM org.firebirdsql.logging.JulLogger warn
ADVERTÊNCIA: WARNING: No connection character set specified (property lc_ctype, encoding, charSet or localEncoding), defaulting to character set NONE
abr 12, 2018 1:52:30 PM org.apache.catalina.core.StandardWrapperValve invoke
GRAVE: Servlet.service() for servlet [Servlet ComercialApp REST] in context with path [/webservice] threw exception [org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]] with root cause
org.firebirdsql.jdbc.FBSQLExceptionInfo: Incompatible wire encryption levels requested on client and server
Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Sérgio Thiago Mendonça
  • 1,161
  • 2
  • 13
  • 23

2 Answers2

1

Jaybird 3 versions before 3.0.4 did not support the wire protocol encryption introduced in Firebird 3, and by default Firebird 3 requires a connection to be encrypted. If encryption is not supported (or disabled) by the client (Jaybird in this case), the connection is rejected.

To allow Jaybird to connect, upgrade to Jaybird 3.0.4 or higher. Jaybird 3.0.4 introduced support for wire protocol encryption. Alternatively, if you can't upgrade yet, you need to edit firebird.conf of your Firebird install, and change (or add) the following property:

WireCrypt = Enabled

The default is Required. Be aware that entries prefixed with a # are comments. After changing the configuration, Firebird server needs to be restarted.

See also:

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
0

It works when i set the property hibernate.connection.url like this:

<property name="hibernate.connection.url" value="jdbc:firebirdsql:192.109.81.145/3050:c:\database\DATABASE.FDB"/>
Sérgio Thiago Mendonça
  • 1,161
  • 2
  • 13
  • 23