I am trying to connect to my SQL Server 2008 database from Java and I\'m having the same problem from this thread.
String userName = \"xxxx\";
String password =
For me, it worked once I changed
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
to:
in POM
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.1.0.jre8</version>
</dependency>
and then:
import com.microsoft.sqlserver.jdbc.SQLServerDriver;
...
DriverManager.registerDriver(SQLServerDriver());
Connection connection = DriverManager.getConnection(connectionUrl);
intellij idea 2019
(https://docs.microsoft.com/en-us/sql/connect/jdbc/download-microsoft-jdbc-driver-for-sql-server?view=sql-server-2017)
or ub Gradle set "compile" compile group: 'com.microsoft.sqlserver', name: 'mssql-jdbc', version: '7.2.2.jre11'