10

I want to connect my Java SpringBoot app to SQL Server and I get the information that spring cannot load driver class. I tried:

spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver

and

spring.datasource.driver-class-name=com.microsoft.jdbc.sqlserver.SQLServerDriver

But both did not work, here is my maven dependency

<dependency>
    <groupId>com.microsoft.sqlserver</groupId>
    <artifactId>mssql-jdbc</artifactId>
    <version>7.0.0.jre8</version>
    <scope>test</scope>
</dependency>
Tim Biegeleisen
  • 451,927
  • 24
  • 239
  • 318
Clyde Barrow
  • 1,512
  • 3
  • 22
  • 51

1 Answers1

20

According to this web page, the correct property is spring.datasource.driverClassName.

So, the full connection string should be:

spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
Tim Biegeleisen
  • 451,927
  • 24
  • 239
  • 318
Shepard62FR
  • 240
  • 2
  • 10