Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the driver class name for SQL Server JDBC

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>
like image 926
Clyde Barrow Avatar asked Oct 09 '18 07:10

Clyde Barrow


People also ask

What is the class name for JDBC driver?

Class OracleDriver. The Oracle JDBC driver class that implements the java. sql. Driver interface.

Where is SQL Server JDBC driver installed?

The JDBC driver files are installed in C:\program files\microsoft SQL server <ver> JDBC Driver\lib.


1 Answers

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
like image 74
Shepard62FR Avatar answered Oct 20 '22 04:10

Shepard62FR