In order to use SQL server with Spring Boot and Data JPA, we need to do the following
- Add SQL server jdbc driver to pom.xml. Change the jre11 value to your JRE version
<dependency> <groupId>com.microsoft.sqlserver</groupId> <artifactId>mssql-jdbc</artifactId> <version>8.2.2.jre11</version> </dependency> - Add the following properties in application.yml file
spring: application: name: SpringSecurity-Data-Application # Jpa Properties datasource: url: jdbc:sqlserver://localhost;databaseName=spring_security_data username: sa password: <your password here> driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver jpa: open-in-view: true generate-ddl: true properties: hibernate: ddl-auto: update show_sql: true dialect: org.hibernate.dialect.SQLServer2012Dialect - Make sure to double check datasource URL, driver class name and hibernate.dialect properties