I've created a new Spring Boot project. I'm trying to setup a DataSource to use MSSQL. However I seem to be getting the error "Unable to load class: com.microsoft.sqlserver.jdbc.SQLServerDriver"
I've placed the file jdbcsql4.jar in a folder in my project /lib/jdbcsq4.jar
In my pom.xml file I've added the following:
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
<scope>system</scope>
<optional>true</optional>
<systemPath>${basedir}/lib/sqljdbc4.jar</systemPath>
</dependency>
I have an application.properties file, and I'm defining the database credentials like this:
secondary.datasource.url = jdbc:sqlserver://1.1.1.1:50109
secondary.datasource.username = sa
secondary.datasource.password = mypassword
secondary.datasource.driver-class-name = com.microsoft.sqlserver.jdbc.SQLServerDriver
Can anyone possibly indicate where I may be going wrong?
I managed to solve this issue by following the instructions in this link http://claude.betancourt.us/add-microsoft-sql-jdbc-driver-to-maven/
EDIT: The original link above no longer exists, but here's a similar link. http://biercoff.com/add-microsoft-sql-jdbc-driver-to-maven/
For the ppl who facing these issue. Add dependency in POM. Microsoft finally made the driver available on the Maven Central Repository.
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.1.0.jre8</version>
</dependency>
you can check here. Microsoft link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With