英文:
SequenceInformation missing
问题
我正在使用Spring Boot应用程序连接到AS400数据库,使用com.ibm.db2.jcc.DB2Driver驱动程序和Spring Data JPA。我使用org.hibernate.dialect.DB2Dialect方言。当我启动应用程序时,我收到以下错误消息:
"无法从数据库中获取SequenceInformation
com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL错误:SQLCODE=-204,SQLSTATE=42704,SQLERRMC=SYSCAT.SEQUENCES;TABLE,DRIVER=4.26.14"
这意味着表SYSCAT.SEQUENCES
丢失,因为它不需要存在。应用程序正常运行,但这个错误让我感到困扰。据我所见,只有在我某个地方生成ID时,SequenceInformation才是重要的,而我并没有这样做。这个应用程序只用于从一个地方复制数据到另一个地方,所以我只使用JPAs的@Id
注解,而不使用@GeneratedValue
注解。我是否错过了SequenceInformation的某种用途?有没有办法关闭SequenceInformation的获取?
以下是我的应用程序属性:
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:
ddl-auto: none
dialect: org.hibernate.dialect.DB2Dialect
naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
英文:
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
答案1
得分: 24
你使用了错误的方言。请使用:
org.hibernate.dialect.DB2400Dialect
英文:
You use the wrong dialect. Please use:
org.hibernate.dialect.DB2400Dialect
答案2
得分: 3
我已将方言从DB2Dialect更改为DB2400Dialect,并且对我有效。
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.DB2Dialect
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.DB2400Dialect
英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论