Spring boot SQL Dialect

1.9k Views Asked by At

I'm new to spring and trying run a simple spring code and for database it's ms-sql. but it is giving an Exception as dialect issue. here is the code. please look at it

spring.datasource.url=jdbc:sqlserver://localhost;databaseName=login_Demo;trustServerCertificate=true;
spring.datasource.username=sa
spring.datasource.password=Bisht@123
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.hibernate.ddl-auto = update
spring.jpa.open-in-view=true
server.port=8000

Error is

2022-07-10 09:53:35.322  WARN 5220 --- [ main] o.h.t.s.i.ExceptionHandlerLoggedImpl : GenerationTarget encountered exception accepting command : 
Error executing DDL 
"create table user 
(id integer not null auto_increment, 
 email varchar(255), 
 first_name varchar(255), 
 last_name varchar(255), 
 password varchar(255), 
 primary key (id)) engine=InnoDB" via 
JDBC Statement org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL 
     "create table user (id integer not null auto_increment, email varchar(255), first_name 
   varchar(255), last_name varchar(255), password varchar(255), primary key (id)) engine=InnoDB" 
    via JDBC Statement
2

There are 2 best solutions below

2
Parag Bhangale On

as you are using MSSQL database. So properties are wrong.

for eg. spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver spring.jpa.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect please check as per your version first.

0
Sourabh Bisht On

I have resolved this issue. The error was in dependencies. I haven't added proper dependency. I rebuild the application again and it came alive.