HikariCP with Firebird/jaybird DataSource problem

573 views
Skip to first unread message

Bill Lyons

unread,
Feb 21, 2018, 12:07:57 PM2/21/18
to HikariCP
Hi,

I using the jaybird-jdk18-3.0.1.jar JDBC Driver jar.  I'm trying to build a successful connection to a Firebird DB running on Windows using Spring Data JPA, Hibernate and a HikariCP Connection Pool.  I have gotten everything to run correctly on other JDBC compliant DBs (H2, Derby, MySQL, etc.) but when I switch my driver .jar over to Firebird I get:


    Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in com.application.Application: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1081)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:856)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
    at org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>(AnnotationConfigApplicationContext.java:84)
    at com.application.Application.main(Application.java:43)
    Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:267)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:231)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:210)
    at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:51)
    at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:94)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:240)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:210)
    at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.handleTypes(MetadataBuildingProcess.java:352)
    at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:111)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:858)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:885)
    at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60)
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:353)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:370)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:359)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)
    ... 11 more
    Caused by: org.hibernate.HibernateException: java.lang.RuntimeException: Property url does not exist on target class org.firebirdsql.ds.FBSimpleDataSource

Here's an extract of my Spring application.properties:

    spring.jpa.properties.javax.persistence.provider=org.hibernate.jpa.HibernatePersistenceProvider

    spring.jpa.properties.hibernate.hikari.dataSourceClassName=org.firebirdsql.ds.FBSimpleDataSource
    spring.jpa.properties.hibernate.hikari.dataSource.url=jdbc:firebirdsql:server:/db/test123.GDB?charSet=UTF-8&amp;roleName=USER;
    spring.jpa.properties.hibernate.hikari.dataSource.user=SYSDBA
    spring.jpa.properties.hibernate.hikari.dataSource.password=password
    spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.FirebirdDialect
    
    spring.jpa.properties.hibernate.hikari.minimumIdle=5
    spring.jpa.properties.hibernate.hikari.maximumPoolSize=10
    spring.jpa.properties.hibernate.hikari.idleTimeout=30000
    spring.jpa.properties.hibernate.connection.handling_mode=delayed_acquisition_and_hold
    spring.jpa.properties.hibernate.connection.provider_class=org.hibernate.hikaricp.internal.HikariCPConnectionProvider

I have tested using a few of the other classes that implement javax.sql.DataSource for the spring.jpa.properties.hibernate.hikari.dataSourceClassName property but all give variations of the cannot connect Exception.

Brett Wooldridge

unread,
Feb 21, 2018, 3:33:15 PM2/21/18
to hika...@googlegroups.com
The JavaDoc for the FireBird DataSource seems to indicate this syntax for setDatabase():

//localhost:3050/c:/database/employee.fdb

Given this, I would try:

    spring.jpa.properties.javax.persistence.provider=org.hibernate.jpa.HibernatePersistenceProvider
    spring.jpa.properties.hibernate.hikari.dataSourceClassName=org.firebirdsql.ds.FBSimpleDataSource
    spring.jpa.properties.hibernate.hikari.dataSource.database=//server:port/C:/db/test123.GDB
    spring.jpa.properties.hibernate.hikari.dataSource.charSet=UTF-8
    spring.jpa.properties.hibernate.hikari.dataSource.userName=SYSDBA
    spring.jpa.properties.hibernate.hikari.dataSource.password=password
    spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.FirebirdDialect
    ...

See the third screenshot here.  Basically, setter methods on the FBSimpleDataSource class translate to dataSource properties.  For example, setCharSet(String) >> dataSource.charSet, setUserName(String) >> dataSource.userName.

-Brett


Bill Lyons

unread,
Feb 23, 2018, 10:03:02 AM2/23/18
to hika...@googlegroups.com
Hi Brett,

Thank you for the reply.  That is most definitely on the right track.  I'm working directly with Mark Rotteveel from Firebird Java team to resolve my issues.  Looks like I needed to do a little more RTFM to understand differences in the jaybird drivers.

Bill

On Wed, Feb 21, 2018 at 1:33 PM, Brett Wooldridge <brett.wo...@gmail.com> wrote:
The JavaDoc for the FireBird DataSource seem to indicate this syntax for setDatabase():

--
You received this message because you are subscribed to a topic in the Google Groups "HikariCP" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hikari-cp/if4OT0Y8xOA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hikari-cp+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/hikari-cp.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages