SequenceInformation missing
Asked Answered
P

2

12

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
Precautious answered 6/1, 2020 at 10:31 Comment(1)
Hi, thanks for this question, i had the same problem and same scenario, i sugges to change the title of question to "sequence information cannot be fetched frim DB2" and thanks againTreacherous
F
24

You use the wrong dialect. Please use:

org.hibernate.dialect.DB2400Dialect
Fanaticism answered 6/1, 2020 at 11:11 Comment(4)
Could you please point to any documentation for this. Not sure why every post and documentation suggests using org.hibernate.dialect.DB2DialectPerforation
Man!! I have been searching for this since last 4 hours. Thank you for this answer.Vltava
Thanks, i had the same problem and i found this response is very usefulTreacherous
yes but now there is a warning "DB2AS400Diealect is deprecated, use DB2Dialect instead" but using DB2Dialect there is an error "SEQUENCES in SYSCAT of type *FILE not found"...Bryozoan
P
3

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
Pseudoscope answered 29/5, 2021 at 11:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.