Reputation: 941
Using Postgres as database and Spring Boot + Spring Data I am trying to start my application in test mode with the following database configuration properties:
spring.datasource.driverClassName=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://localhost/members
spring.jpa.hibernate.ddl-auto=create-drop
spring.datasource.username=postgres
spring.datasource.password=password
spring.jpa.show-sql=true
My Table name is named 'Member'
When I run the application for the first time I can see that the table gets created. However I keep getting the following error:
2017-06-29 21:51:03.092 ERROR 1472 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: drop table member if exists
2017-06-29 21:51:03.093 ERROR 1472 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : ERROR: syntax error at or near "if"
Upvotes: 1
Views: 3953
Reputation: 89
I am using H2 and have the same error "Unsuccessful: drop table xxx if exists".
I tried all the dll-auto and dialect settings but it doesn't work.
Then I found in my computer home directory a file called
test.mv.db
where "test" is the name I set in Spring for my H2 database.
If I delete this file, everything works fine when I reboot the application.
Upvotes: 0
Reputation: 517
In your application.properties, try to add the following :
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQL9Dialect
That might help your ORM to adapt its language to the database you're using.
Cheers !
Upvotes: 1