I have a spring-boot project in which i try to connect to an azure sql database i just created. First time i tried it i was using sqljdbc4 under com.microsoft.sqlserver groupId, everytime i tried to launch it i had security errors, googling around i found out it's fixed by using 6+ versions. Then i installed it and set the dependency
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>slqjdbc6</artifactId>
<version>6.2.1</version>
</dependency>
Now i don't have that error anymore but instead i have org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Tomcat.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.tomcat.jdbc.pool.DataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: com.microsoft.sqlserver.jdbc.SQLServerDriver
Dependencies
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>slqjdbc6</artifactId>
<version>6.2.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
application.properties
spring.h2.console.enabled=true
spring.h2.console.path=/console
spring.datasource.platform=h2
# production profile
spring.datasource.url=jdbc:sqlserver://spring-boot-intro.database.windows.net:1433;database=spring-boot-intro;user=fabio@spring-boot-intro;password=*my password*;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;
spring.datasource.username=fabio
spring.datasource.password=*my password*
spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
# crud
spring.jpa.hibernate.ddl-auto=create-drop
slqjdbc6 under .m2 repository
C:\Users\*user*\.m2\repository\com\microsoft\sqlserver\slqjdbc6\maven-metadata-local.xml
C:\Users\*user*\.m2\repository\com\microsoft\sqlserver\slqjdbc6\6\_remote.repositories
C:\Users\*user*\.m2\repository\com\microsoft\sqlserver\slqjdbc6\6\slqjdbc6-6.2.1.jar
C:\Users\*user*\.m2\repository\com\microsoft\sqlserver\slqjdbc6\6\slqjdbc6-6.2.1.pom