Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SequenceInformation missing

I'm working with a Spring boot Application connecting to an AS400 Database using the com.ibm.db2.jcc.DB2Driver driver with Spring Data JPA. I use the org.hibernate.dialect.DB2Dialect dialect. When I start the Application, I get the Error

Could not fetch the SequenceInformation from the database
com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=SYSCAT.SEQUENCES;TABLE, DRIVER=4.26.14

Meaning the Table SYSCAT.SEQUENCES is missing, which it is, because it's not needed. The Application works fine, but the error bothers me. As far as I see, SequenceInformations are only important when I generate an ID somewhere, what I don't do. This Application is only used to copy data from one place to another, so I only use JPAs @Id annotation but not the @GeneratedValue one. Am I missing some use for the SequenceInformation? Is there some way to turn off the fetching of SequenceInformation?

Those are my application properties:

spring:
  datasource:
    driver-class-name: com.ibm.db2.jcc.DB2Driver
    hikari.connection-test-query: values 1
    hikari.maximum-pool-size: 25
  jpa:
    database-platform: DB2Platform
    hibernate.ddl-auto: none
    open-in-view: false
    properties:
      hibernate:
        dll-auto: none
        dialect: org.hibernate.dialect.DB2Dialect
        naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
like image 948
Urr4 Avatar asked Jan 06 '20 10:01

Urr4


2 Answers

You use the wrong dialect. Please use:

org.hibernate.dialect.DB2400Dialect
like image 132
Simon Martinelli Avatar answered Oct 20 '22 13:10

Simon Martinelli


I have changed dialect from DB2Dialect to DB2400Dialect and it worked for me.

##spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.DB2Dialect
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.DB2400Dialect
like image 2
Hanamant Jadhav Avatar answered Oct 20 '22 12:10

Hanamant Jadhav