GenerationTarget encountered exception accepting command : Error executing DDL
Issue
I am using H₂ in-memory database for my Spring Boot application. Where I have enabled.hibernate.ddl-auto
I am getting below exception while hibernate is creating a schema
GenerationTarget encountered exception accepting command : Error executing DDL “create table cred (`credid` integer not null, `authorization` varchar(750), `cookies` varchar(750), `useragent` varchar(150), `username` varchar(10), primary key (`credid`)) engine=InnoDB” via JDBC Statement
H2 DB Configuration
spring: h2: console: enabled: true datasource: url: 'jdbc:h2:file:~/Downloads/CustomUtil/Db/customutildb;IGNORECASE=TRUE' driverClassName: org.h2.Driver username: sa password: null maximumPoolSize: 10 minimumIdle: 5 idleTimeout: 60000 maxLifetime: 120000 leakDetectionThreshold: 180000 poolName: customutilpool jpa: database-platform: org.hibernate.dialect.MySQL5InnoDBDialect generate-ddl: true show-sql: true hibernate: ddl-auto: update
Solution:
spring: h2: console: enabled: true datasource: url: jdbc:h2:file:~/Downloads/CustomUtil/Db/customutildb;IGNORECASE=TRUE driverClassName: org.h2.Driver username: sa password: maximumPoolSize: 10 minimumIdle: 5 idleTimeout: 60000 maxLifetime: 120000 leakDetectionThreshold: 180000 poolName: "customutilpool" jpa:
database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
generate-ddl: true show-sql: true hibernate: ddl-auto: update
database-platform: org.hibernate.dialect.MySQL5InnoDBDialect, After removing this it started working as this line was adding “engine=InnoDB” after create query without semicolon which was causing syntax error.
Leave a Reply