0

I have a spring boot (vers 2.6.12) project with quartz and sybase jconnect driver dependencies(excluding all other deps):

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-quartz</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

<dependency>
    <groupId>sybase</groupId>
    <artifactId>jconnect</artifactId>
    <version>16.04.1</version>
</dependency>

I have my scheduler config:

@Configuration
@AllArgsConstructor
public class SchedulerConfig {

    private final AutowireCapableBeanFactory beanFactory;
    private final DataSource dataSource;
    private final ApplicationContext context;
    private final QuartzProperties quartzProperties;

    @Bean
    public SchedulerFactoryBean schedulerFactoryBean() {

        var jobs = new SchedulerJobFactory(beanFactory);
        jobs.setApplicationContext(context);

        var properties = new Properties();
        properties.putAll(quartzProperties.getProperties());

        var factory = new SchedulerFactoryBean();
        factory.setOverwriteExistingJobs(true);
        factory.setDataSource(dataSource);
        factory.setQuartzProperties(properties);
        factory.setJobFactory(jobs);

        return factory;

    }

}

and my quartz initialization script (which is a modified version of the included sybase script:

/*==============================================================================*/
/* Clear all tables: */
/*==============================================================================*/

IF (OBJECT_ID('QRTZ_FIRED_TRIGGERS')) IS NOT NULL
begin
    execute ('delete from QRTZ_FIRED_TRIGGERS')
end

IF OBJECT_ID('QRTZ_PAUSED_TRIGGER_GRPS') IS NOT NULL
begin
    execute ('delete from QRTZ_PAUSED_TRIGGER_GRPS')
end

IF OBJECT_ID('QRTZ_SCHEDULER_STATE') IS NOT NULL
begin
    execute ('delete from QRTZ_SCHEDULER_STATE')
end

IF OBJECT_ID('QRTZ_LOCKS') IS NOT NULL
begin
    execute ('delete from QRTZ_LOCKS')
end

IF OBJECT_ID('QRTZ_SIMPLE_TRIGGERS') IS NOT NULL
begin
    execute ('delete from QRTZ_SIMPLE_TRIGGERS')
end

IF OBJECT_ID('QRTZ_SIMPROP_TRIGGERS') IS NOT NULL
begin
    execute ('delete from QRTZ_SIMPROP_TRIGGERS')
end

IF OBJECT_ID('QRTZ_CRON_TRIGGERS') IS NOT NULL
begin
    execute ('delete from QRTZ_CRON_TRIGGERS')
end

IF OBJECT_ID('QRTZ_BLOB_TRIGGERS') IS NOT NULL
begin
    execute ('delete from QRTZ_BLOB_TRIGGERS')
end

IF OBJECT_ID('QRTZ_TRIGGERS') IS NOT NULL
begin
    execute ('delete from QRTZ_TRIGGERS')
end

IF OBJECT_ID('QRTZ_JOB_DETAILS') IS NOT NULL
begin
    execute ('delete from QRTZ_JOB_DETAILS')
end

IF OBJECT_ID('QRTZ_CALENDARS') IS NOT NULL
begin
    execute ('delete from QRTZ_CALENDARS')
end

/*==============================================================================*/
/* Drop constraints: */
/*==============================================================================*/

IF OBJECT_ID('QRTZ_TRIGGERS') IS NOT NULL
begin
    execute ('alter table QRTZ_TRIGGERS drop
    constraint FK_triggers_job_details')
end

IF OBJECT_ID('QRTZ_CRON_TRIGGERS') IS NOT NULL
begin
    execute ('alter table QRTZ_CRON_TRIGGERS drop
    constraint FK_cron_triggers_triggers')
end

IF OBJECT_ID('QRTZ_SIMPLE_TRIGGERS') IS NOT NULL
begin
    execute ('alter table QRTZ_SIMPLE_TRIGGERS
    drop constraint FK_simple_triggers_triggers')
end

IF OBJECT_ID('QRTZ_SIMPROP_TRIGGERS') IS NOT NULL
begin
    execute ('alter table QRTZ_SIMPROP_TRIGGERS
    drop constraint FK_simprop_triggers_triggers')
end

IF OBJECT_ID('QRTZ_BLOB_TRIGGERS') IS NOT NULL
begin
    execute ('alter table QRTZ_BLOB_TRIGGERS
    drop constraint FK_blob_triggers_triggers')
end

/*==============================================================================*/
/* Drop tables: */
/*==============================================================================*/

IF OBJECT_ID('QRTZ_FIRED_TRIGGERS') IS NOT NULL
begin
    execute ('drop table QRTZ_FIRED_TRIGGERS')
end

IF OBJECT_ID('QRTZ_PAUSED_TRIGGER_GRPS') IS NOT NULL
begin
    execute ('drop table QRTZ_PAUSED_TRIGGER_GRPS')
end

IF OBJECT_ID('QRTZ_SCHEDULER_STATE') IS NOT NULL
begin
    execute ('drop table QRTZ_SCHEDULER_STATE')
end

IF OBJECT_ID('QRTZ_LOCKS') IS NOT NULL
begin
    execute ('drop table QRTZ_LOCKS')
end

IF OBJECT_ID('QRTZ_SIMPLE_TRIGGERS') IS NOT NULL
begin
    execute ('drop table QRTZ_SIMPLE_TRIGGERS')
end

IF OBJECT_ID('QRTZ_SIMPROP_TRIGGERS') IS NOT NULL
begin
    execute ('drop table QRTZ_SIMPROP_TRIGGERS')
end

IF OBJECT_ID('QRTZ_CRON_TRIGGERS') IS NOT NULL
begin
    execute ('drop table QRTZ_CRON_TRIGGERS')
end

IF OBJECT_ID('QRTZ_BLOB_TRIGGERS') IS NOT NULL
begin
    execute ('drop table QRTZ_BLOB_TRIGGERS')
end

IF OBJECT_ID('QRTZ_TRIGGERS') IS NOT NULL
begin
    execute ('drop table QRTZ_TRIGGERS')
end

IF OBJECT_ID('QRTZ_JOB_DETAILS') IS NOT NULL
begin
    execute ('drop table QRTZ_JOB_DETAILS')
end

IF OBJECT_ID('QRTZ_CALENDARS') IS NOT NULL
begin
    execute ('drop table QRTZ_CALENDARS')
end

/*==============================================================================*/
/* Create tables: */
/*==============================================================================*/

IF OBJECT_ID('QRTZ_CALENDARS') IS NULL
begin
    execute('create table QRTZ_CALENDARS (
    SCHED_NAME varchar(120) not null,
    CALENDAR_NAME varchar(200) not null,
    CALENDAR image not null
    )')
end

IF OBJECT_ID('QRTZ_CRON_TRIGGERS') IS NULL
begin
    execute('create table QRTZ_CRON_TRIGGERS (
    SCHED_NAME varchar(120) not null,
    TRIGGER_NAME varchar(200) not null,
    TRIGGER_GROUP varchar(200) not null,
    CRON_EXPRESSION varchar(120) not null,
    TIME_ZONE_ID varchar(80) null,
    )')
end

IF OBJECT_ID('QRTZ_PAUSED_TRIGGER_GRPS') IS NULL
begin
    execute('create table QRTZ_PAUSED_TRIGGER_GRPS (
    SCHED_NAME varchar(120) not null,
    TRIGGER_GROUP  varchar(200) not null,
    )')
end

IF OBJECT_ID('QRTZ_FIRED_TRIGGERS') IS NULL
begin
    execute('create table QRTZ_FIRED_TRIGGERS(
    SCHED_NAME varchar(120) not null,
    ENTRY_ID varchar(95) not null,
    TRIGGER_NAME varchar(200) not null,
    TRIGGER_GROUP varchar(200) not null,
    INSTANCE_NAME varchar(200) not null,
    FIRED_TIME numeric(13,0) not null,
    SCHED_TIME numeric(13,0) not null,
    PRIORITY int not null,
    STATE varchar(16) not null,
    JOB_NAME varchar(200) null,
    JOB_GROUP varchar(200) null,
    IS_NONCONCURRENT bit not null,
    REQUESTS_RECOVERY bit not null,
    )')
end

IF OBJECT_ID('QRTZ_SCHEDULER_STATE') IS NULL
begin
    execute('create table QRTZ_SCHEDULER_STATE (
    SCHED_NAME varchar(120) not null,
    INSTANCE_NAME varchar(200) not null,
    LAST_CHECKIN_TIME numeric(13,0) not null,
    CHECKIN_INTERVAL numeric(13,0) not null,
    )')
end

IF OBJECT_ID('QRTZ_LOCKS') IS NULL
begin
    execute('create table QRTZ_LOCKS (
    SCHED_NAME varchar(120) not null,
    LOCK_NAME  varchar(40) not null,
    )')
end

IF OBJECT_ID('QRTZ_JOB_DETAILS') IS NULL
begin
    execute('create table QRTZ_JOB_DETAILS (
    SCHED_NAME varchar(120) not null,
    JOB_NAME varchar(200) not null,
    JOB_GROUP varchar(200) not null,
    DESCRIPTION varchar(250) null,
    JOB_CLASS_NAME varchar(250) not null,
    IS_DURABLE bit not null,
    IS_NONCONCURRENT bit not null,
    IS_UPDATE_DATA bit not null,
    REQUESTS_RECOVERY bit not null,
    JOB_DATA image null
    )')
end

IF OBJECT_ID('QRTZ_SIMPLE_TRIGGERS') IS NULL
begin
    execute('create table QRTZ_SIMPLE_TRIGGERS (
    SCHED_NAME varchar(120) not null,
    TRIGGER_NAME varchar(200) not null,
    TRIGGER_GROUP varchar(200) not null,
    REPEAT_COUNT numeric(13,0) not null,
    REPEAT_INTERVAL numeric(13,0) not null,
    TIMES_TRIGGERED numeric(13,0) not null
    )')
end

IF OBJECT_ID('QRTZ_SIMPROP_TRIGGERS') IS NULL
begin
    execute('CREATE TABLE QRTZ_SIMPROP_TRIGGERS (
    SCHED_NAME VARCHAR(120) NOT NULL,
    TRIGGER_NAME VARCHAR(200) NOT NULL,
    TRIGGER_GROUP VARCHAR(200) NOT NULL,
    STR_PROP_1 VARCHAR(512) NULL,
    STR_PROP_2 VARCHAR(512) NULL,
    STR_PROP_3 VARCHAR(512) NULL,
    INT_PROP_1 INT NULL,
    INT_PROP_2 INT NULL,
    LONG_PROP_1 NUMERIC(13,0) NULL,
    LONG_PROP_2 NUMERIC(13,0) NULL,
    DEC_PROP_1 NUMERIC(13,4) NULL,
    DEC_PROP_2 NUMERIC(13,4) NULL,
    BOOL_PROP_1 bit NOT NULL,
    BOOL_PROP_2 bit NOT NULL
    )')
end

IF OBJECT_ID('QRTZ_BLOB_TRIGGERS') IS NULL
begin
    execute('create table QRTZ_BLOB_TRIGGERS (
    SCHED_NAME varchar(120) not null,
    TRIGGER_NAME varchar(200) not null,
    TRIGGER_GROUP varchar(200) not null,
    BLOB_DATA image null
    )')
end

IF OBJECT_ID('QRTZ_TRIGGERS') IS NULL
begin
    execute('create table QRTZ_TRIGGERS (
    SCHED_NAME varchar(120) not null,
    TRIGGER_NAME varchar(200) not null,
    TRIGGER_GROUP varchar(200) not null,
    JOB_NAME varchar(200) not null,
    JOB_GROUP varchar(200) not null,
    DESCRIPTION varchar(250) null,
    NEXT_FIRE_TIME numeric(13,0) null,
    PREV_FIRE_TIME numeric(13,0) null,
    PRIORITY int null,
    TRIGGER_STATE varchar(16) not null,
    TRIGGER_TYPE varchar(8) not null,
    START_TIME numeric(13,0) not null,
    END_TIME numeric(13,0) null,
    CALENDAR_NAME varchar(200) null,
    MISFIRE_INSTR smallint null,
    JOB_DATA image null
    )')
end

/*==============================================================================*/
/* Create primary key constraints: */
/*==============================================================================*/

IF OBJECT_ID('QRTZ_CALENDARS') IS NOT NULL
begin
    execute ('alter table QRTZ_CALENDARS
    add constraint PK_qrtz_calendars primary key clustered (SCHED_NAME,CALENDAR_NAME)')
end

IF OBJECT_ID('QRTZ_CRON_TRIGGERS') IS NOT NULL
begin
    execute ('alter table QRTZ_CRON_TRIGGERS
    add constraint PK_qrtz_cron_triggers primary key clustered (SCHED_NAME,TRIGGER_NAME, TRIGGER_GROUP)')
end

IF OBJECT_ID('QRTZ_FIRED_TRIGGERS') IS NOT NULL
begin
    execute ('alter table QRTZ_FIRED_TRIGGERS
    add constraint PK_qrtz_fired_triggers primary key clustered (SCHED_NAME,ENTRY_ID)')
end

IF OBJECT_ID('QRTZ_PAUSED_TRIGGER_GRPS') IS NOT NULL
begin
    execute ('alter table QRTZ_PAUSED_TRIGGER_GRPS
    add constraint PK_qrtz_paused_trigger_grps primary key clustered (SCHED_NAME,TRIGGER_GROUP)')
end

IF OBJECT_ID('QRTZ_SCHEDULER_STATE') IS NOT NULL
begin
    execute ('alter table QRTZ_SCHEDULER_STATE
    add constraint PK_qrtz_scheduler_state primary key clustered (SCHED_NAME,INSTANCE_NAME)')
end

IF OBJECT_ID('QRTZ_LOCKS') IS NOT NULL
begin
    execute ('alter table QRTZ_LOCKS
    add constraint PK_qrtz_locks primary key clustered (SCHED_NAME,LOCK_NAME)')
end

IF OBJECT_ID('QRTZ_JOB_DETAILS') IS NOT NULL
begin
    execute ('alter table QRTZ_JOB_DETAILS
    add constraint PK_qrtz_job_details primary key clustered (SCHED_NAME,JOB_NAME, JOB_GROUP)')
end

IF OBJECT_ID('QRTZ_SIMPLE_TRIGGERS') IS NOT NULL
begin
    execute ('alter table QRTZ_SIMPLE_TRIGGERS
    add constraint PK_qrtz_simple_triggers primary key clustered (SCHED_NAME,TRIGGER_NAME, TRIGGER_GROUP)')
end

IF OBJECT_ID('QRTZ_SIMPROP_TRIGGERS') IS NOT NULL
begin
    execute ('alter table QRTZ_SIMPROP_TRIGGERS
    add constraint PK_qrtz_simprop_triggers primary key clustered (SCHED_NAME,TRIGGER_NAME, TRIGGER_GROUP)')
end

IF OBJECT_ID('QRTZ_TRIGGERS') IS NOT NULL
begin
    execute ('alter table QRTZ_TRIGGERS
    add constraint PK_qrtz_triggers primary key clustered (SCHED_NAME,TRIGGER_NAME, TRIGGER_GROUP)')
end

IF OBJECT_ID('QRTZ_BLOB_TRIGGERS') IS NOT NULL
begin
    execute ('alter table QRTZ_BLOB_TRIGGERS
    add constraint PK_qrtz_blob_triggers primary key clustered (SCHED_NAME,TRIGGER_NAME, TRIGGER_GROUP)')
end

/*==============================================================================*/
/* Create foreign key constraints: */
/*==============================================================================*/

IF OBJECT_ID('QRTZ_CRON_TRIGGERS') IS NOT NULL
begin
    execute ('alter table QRTZ_CRON_TRIGGERS
    add constraint FK_cron_triggers_triggers foreign key (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
    references QRTZ_TRIGGERS (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)')
end

IF OBJECT_ID('QRTZ_SIMPLE_TRIGGERS') IS NOT NULL
begin
    execute ('alter table QRTZ_SIMPLE_TRIGGERS
    add constraint FK_simple_triggers_triggers foreign key (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
    references QRTZ_TRIGGERS (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)')
end

IF OBJECT_ID('QRTZ_SIMPROP_TRIGGERS') IS NOT NULL
begin
    execute ('alter table QRTZ_SIMPROP_TRIGGERS
    add constraint FK_simprop_triggers_triggers foreign key (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
    references QRTZ_TRIGGERS (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)')
end

IF OBJECT_ID('QRTZ_TRIGGERS') IS NOT NULL
begin
    execute ('alter table QRTZ_TRIGGERS
    add constraint FK_triggers_job_details foreign key (SCHED_NAME,JOB_NAME,JOB_GROUP)
    references QRTZ_JOB_DETAILS (SCHED_NAME,JOB_NAME,JOB_GROUP)')
end

IF OBJECT_ID('QRTZ_BLOB_TRIGGERS') IS NOT NULL
begin
    execute ('alter table QRTZ_BLOB_TRIGGERS
    add constraint FK_blob_triggers_triggers foreign key (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
    references QRTZ_TRIGGERS (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)')
end
/*==============================================================================*/
/* End of script. */
/*==============================================================================*/

I am running this script through DBeaver without issues against a sybase instance with details:

Server: Adaptive Server Enterprise 16.0.04.02
Driver: jConnect (TM) for JDBC (TM) jConnect (TM) for JDBC(TM)/16.0 SP03 PL02 (Build 27403)/P/EBF27518/JDK 1.6.0/jdbcmain/OPT/Mon Aug 28 18:41:14 PDT 2017

My (relevant) spring application settings:

spring.datasource.url=jdbc:sybase:Tds:localhost:6000/Kustom
spring.datasource.driverClassName=com.sybase.jdbc4.jdbc.SybDriver
spring.datasource.username=user
spring.datasource.password=pass

spring.jpa.database-platform=org.hibernate.dialect.SybaseASE15Dialect
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.SybaseASE15Dialect
spring.jpa.properties.hibernate.use_sql_comments=true
spring.jpa.properties.hibernate.format_sql=true

spring.quartz.job-store-type=jdbc
spring.quartz.jdbc.initialize-schema=always
spring.quartz.jdbc.schema=classpath:jdbc/my_script.sql

spring.quartz.properties.org.quartz.jobStore.tablePrefix=QRTZ_
spring.quartz.properties.org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.SybaseDelegate


spring.jpa.show-sql=true
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl

logging.level.org.hibernate.type=TRACE

My application keeps failing with the following stack trace:

2023-02-15 10:48:53.630  INFO 1 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.SybaseASE15Dialect
2023-02-15 10:48:53.766 DEBUG 1 --- [           main] o.h.type.spi.TypeConfiguration$Scope     : Scoping TypeConfiguration [org.hibernate.type.spi.TypeConfiguration@385ef531] to MetadataBuildingContext [org.hibernate.boot.internal.MetadataBuildingContextRootImpl@7fc645e4]
2023-02-15 10:48:54.136 DEBUG 1 --- [           main] o.h.type.spi.TypeConfiguration$Scope     : Scoping TypeConfiguration [org.hibernate.type.spi.TypeConfiguration@385ef531] to SessionFactoryImpl [org.hibernate.internal.SessionFactoryImpl@48284d0e]
2023-02-15 10:48:54.303  WARN 1 --- [           main] o.h.engine.jdbc.spi.SqlExceptionHelper   : SQL Error: 911, SQLState: ZZZZZ
2023-02-15 10:48:54.303 ERROR 1 --- [           main] o.h.engine.jdbc.spi.SqlExceptionHelper   : Attempt to locate entry in sysdatabases for database 'KUSTOM' by name failed - no entry found under that name. Make sure that name is entered properly.

2023-02-15 10:48:54.307 TRACE 1 --- [           main] o.h.type.spi.TypeConfiguration$Scope     : Handling #sessionFactoryClosed from [org.hibernate.internal.SessionFactoryImpl@48284d0e] for TypeConfiguration
2023-02-15 10:48:54.308 DEBUG 1 --- [           main] o.h.type.spi.TypeConfiguration$Scope     : Un-scoping TypeConfiguration [org.hibernate.type.spi.TypeConfiguration$Scope@11e33bac] from SessionFactory [org.hibernate.internal.SessionFactoryImpl@48284d0e]
2023-02-15 10:48:54.313 ERROR 1 --- [           main] j.LocalContainerEntityManagerFactoryBean : Failed to initialize JPA EntityManagerFactory: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.GenericJDBCException: Error accessing table metadata
2023-02-15 10:48:54.314  WARN 1 --- [           main] onfigReactiveWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.GenericJDBCException: Error accessing table metadata
2023-02-15 10:48:54.315  INFO 1 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
2023-02-15 10:48:54.946  INFO 1 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.
2023-02-15 10:48:54.958  INFO 1 --- [           main] o.e.jetty.server.handler.ContextHandler  : Stopped o.e.j.s.ServletContextHandler@3dd69f5a{/,null,STOPPED}
2023-02-15 10:48:54.999  INFO 1 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-02-15 10:48:55.098 ERROR 1 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.GenericJDBCException: Error accessing table metadata
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.3.23.jar!/:5.3.23]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.23.jar!/:5.3.23]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.23.jar!/:5.3.23]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.23.jar!/:5.3.23]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.23.jar!/:5.3.23]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.23.jar!/:5.3.23]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.23.jar!/:5.3.23]
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154) ~[spring-context-5.3.23.jar!/:5.3.23]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908) ~[spring-context-5.3.23.jar!/:5.3.23]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.23.jar!/:5.3.23]
    at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:64) ~[spring-boot-2.6.12.jar!/:2.6.12]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:745) ~[spring-boot-2.6.12.jar!/:2.6.12]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:420) ~[spring-boot-2.6.12.jar!/:2.6.12]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) ~[spring-boot-2.6.12.jar!/:2.6.12]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1317) ~[spring-boot-2.6.12.jar!/:2.6.12]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[spring-boot-2.6.12.jar!/:2.6.12]
    at com.finastra.fusionlimits.enquiries.scheduler.app.Application.main(Application.java:14) ~[classes!/:1.0.0-SNAPSHOT]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[app.jar:1.0.0-SNAPSHOT]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) ~[app.jar:1.0.0-SNAPSHOT]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[app.jar:1.0.0-SNAPSHOT]
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) ~[app.jar:1.0.0-SNAPSHOT]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.GenericJDBCException: Error accessing table metadata
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:421) ~[spring-orm-5.3.23.jar!/:5.3.23]
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) ~[spring-orm-5.3.23.jar!/:5.3.23]
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341) ~[spring-orm-5.3.23.jar!/:5.3.23]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) ~[spring-beans-5.3.23.jar!/:5.3.23]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.3.23.jar!/:5.3.23]
    ... 24 common frames omitted
Caused by: org.hibernate.exception.GenericJDBCException: Error accessing table metadata
    at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42) ~[hibernate-core-5.6.11.Final.jar!/:5.6.11.Final]
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113) ~[hibernate-core-5.6.11.Final.jar!/:5.6.11.Final]
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99) ~[hibernate-core-5.6.11.Final.jar!/:5.6.11.Final]
    at org.hibernate.tool.schema.extract.internal.AbstractInformationExtractorImpl.convertSQLException(AbstractInformationExtractorImpl.java:118) ~[hibernate-core-5.6.11.Final.jar!/:5.6.11.Final]
    at org.hibernate.tool.schema.extract.internal.AbstractInformationExtractorImpl.getTables(AbstractInformationExtractorImpl.java:571) ~[hibernate-core-5.6.11.Final.jar!/:5.6.11.Final]
    at org.hibernate.tool.schema.extract.internal.DatabaseInformationImpl.getTablesInformation(DatabaseInformationImpl.java:122) ~[hibernate-core-5.6.11.Final.jar!/:5.6.11.Final]
    at org.hibernate.tool.schema.internal.GroupedSchemaMigratorImpl.performTablesMigration(GroupedSchemaMigratorImpl.java:68) ~[hibernate-core-5.6.11.Final.jar!/:5.6.11.Final]
    at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.performMigration(AbstractSchemaMigrator.java:220) ~[hibernate-core-5.6.11.Final.jar!/:5.6.11.Final]
    at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.java:123) ~[hibernate-core-5.6.11.Final.jar!/:5.6.11.Final]
    at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:196) ~[hibernate-core-5.6.11.Final.jar!/:5.6.11.Final]
    at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:85) ~[hibernate-core-5.6.11.Final.jar!/:5.6.11.Final]
    at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:335) ~[hibernate-core-5.6.11.Final.jar!/:5.6.11.Final]
    at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:471) ~[hibernate-core-5.6.11.Final.jar!/:5.6.11.Final]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1498) ~[hibernate-core-5.6.11.Final.jar!/:5.6.11.Final]
    at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:58) ~[spring-orm-5.3.23.jar!/:5.3.23]
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365) ~[spring-orm-5.3.23.jar!/:5.3.23]
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) ~[spring-orm-5.3.23.jar!/:5.3.23]
    ... 28 common frames omitted
Caused by: com.sybase.jdbc4.jdbc.SybSQLException: Attempt to locate entry in sysdatabases for database 'KUSTOM' by name failed - no entry found under that name. Make sure that name is entered properly.

    at com.sybase.jdbc4.tds.Tds.processEed(Tds.java:4237) ~[jconnect-16.04.1.jar!/:na]
    at com.sybase.jdbc4.tds.Tds.nextResult(Tds.java:3346) ~[jconnect-16.04.1.jar!/:na]
    at com.sybase.jdbc4.jdbc.ResultGetter.nextResult(ResultGetter.java:78) ~[jconnect-16.04.1.jar!/:na]
    at com.sybase.jdbc4.jdbc.SybStatement.nextResult(SybStatement.java:303) ~[jconnect-16.04.1.jar!/:na]
    at com.sybase.jdbc4.jdbc.SybStatement.nextResult(SybStatement.java:285) ~[jconnect-16.04.1.jar!/:na]
    at com.sybase.jdbc4.jdbc.SybStatement.queryLoop(SybStatement.java:2681) ~[jconnect-16.04.1.jar!/:na]
    at com.sybase.jdbc4.jdbc.SybCallableStatement.executeQuery(SybCallableStatement.java:150) ~[jconnect-16.04.1.jar!/:na]
    at com.sybase.jdbc4.jdbc.SybDatabaseMetaData.returnResults(SybDatabaseMetaData.java:5552) ~[jconnect-16.04.1.jar!/:na]
    at com.sybase.jdbc4.jdbc.SybDatabaseMetaData.getTables(SybDatabaseMetaData.java:4022) ~[jconnect-16.04.1.jar!/:na]
    at com.zaxxer.hikari.pool.ProxyDatabaseMetaData.getTables(ProxyDatabaseMetaData.java:68) ~[HikariCP-4.0.3.jar!/:na]
    at com.zaxxer.hikari.pool.HikariProxyDatabaseMetaData.getTables(HikariProxyDatabaseMetaData.java) ~[HikariCP-4.0.3.jar!/:na]
    at org.hibernate.tool.schema.extract.internal.InformationExtractorJdbcDatabaseMetaDataImpl.processTableResultSet(InformationExtractorJdbcDatabaseMetaDataImpl.java:64) ~[hibernate-core-5.6.11.Final.jar!/:5.6.11.Final]
    at org.hibernate.tool.schema.extract.internal.AbstractInformationExtractorImpl.getTables(AbstractInformationExtractorImpl.java:559) ~[hibernate-core-5.6.11.Final.jar!/:5.6.11.Final]
    ... 40 common frames omitted

PS: Same issue using the included script with quartz (linked earlier).

However if I am using the sourceforge driver with :

spring.datasource.url=jdbc:jtds:sybase://localhost:6000/Kustom
spring.datasource.driverClassName=net.sourceforge.jtds.jdbc.Driver

# Also need these just for the test connection which sourceforge driver is lacking
spring.datasource.validationQuery=select 1
spring.datasource.hikari.connectionTestQuery=select 1

then all seems to work as expected.

How can I make it work using the more modern jconnect driver ?

Thanks

D.Razvan
  • 325
  • 1
  • 5
  • 18

1 Answers1

0

Posting here for anyone facing similar issues to no avail. It seems that the hibernate dialect defaults to an unquoted strategy in this case which for jconnect this renders the database name to use an uppercase strategy.

You have two options, either provide your own dialect which extends the base one, and handle the quoted/unquoted strategy yourself(you simply have to override the buildIdentifierHelper method and use the included builder to set desired strategy) or enable a quoted strategy using:

spring.jpa.properties.hibernate.globally_quoted_identifiers= true

I also added:

spring.jpa.properties.hibernate.globally_quoted_identifiers_skip_column_definitions = true

to avoid some problems with other dialects (from other sources on stackoverflow).

D.Razvan
  • 325
  • 1
  • 5
  • 18