I have previously worked with the SQL Server 2008 Database Engine and have been able to connect to it using the JDBC Driver.
Download and extract the JDBC Driver for SQL Server from Microsoft's Downloads:
Windows Version[
^]
Linux Version[
^]
Once you have your Java Libraries, you can use them in your project to import the libraries.
The following is sample Connection String that you may adopt for connecting to the database.
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class SQLServer2008{
private Connection transactSql() throws SQLException{
Connection connection =
DriverManager.getConnection(
"jdbc:sqlserver://host_ip_address:port_number;databaseName=db_name", "username", "password");
return connection;
}
}
You can then call this method while declaring, initializing, and defining your database connnection. This worked for me, I hope it worked for me.
P.S. If this answer satisfies your need, please approve this answer by marking it as solved.
Thank you.