我试图将Hibernate连接到firebird数据库,但是我收到了错误。
我在persistence.xml中的配置是:
<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"/>
在pom.xml中是:
<dependency>
<groupId>org.firebirdsql.jdbc</groupId>
<artifactId>jaybird-jdk18</artifactId>
<version>3.0.3</version>
</dependency>
错误:
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
答案 0 :(得分:0)
3.0.4之前的Jaybird 3版本不支持Firebird 3中引入的有线协议加密,默认情况下Firebird 3需要加密连接。如果客户端(在这种情况下为Jaybird)不支持(或禁用)加密,则拒绝连接。
要允许Jaybird连接,请升级到Jaybird 3.0.4或更高版本。 Jaybird 3.0.4引入了对线协议加密的支持。或者,如果您尚未升级,则需要编辑Firebird安装的firebird.conf
,并更改(或添加)以下属性:
WireCrypt = Enabled
默认值为Required
。请注意,带有#
前缀的条目是注释。更改配置后,需要重新启动Firebird服务器。
另见:
答案 1 :(得分:0)
当我像这样设置属性hibernate.connection.url时它可以工作:
<property name="hibernate.connection.url" value="jdbc:firebirdsql:192.109.81.145/3050:c:\database\DATABASE.FDB"/>