I'm trying to connect to my database made on SSMS (Microsoft SQL Server Management Studio 18) using Java.
What I've attempted so far:
- I have downloaded SSMS.
- Added JDBC Driver dependency to
pom.xml
- Created a database, table, and queried data.
Snippet of my code:
public static void main(String[] args) throws SQLException {
String dbUrl = "jdbc:sqlserver://localhost;databaseName=TutorialDB;integratedSecurity=true;";
Connection connection = DriverManager.getConnection(dbUrl);
}
Error message:
The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: no further information. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall."