I'm having this error when trying to connect to my SQL Server database, using the common code to do so:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class jdbc{
public static void main(String[] args){
String connectionUrl ="jdbc:sqlserver://localhost:1433;databaseName=caso1;integratedSecurity=true";
try (Connection connection = DriverManager.getConnection(connectionUrl);) {
// Code here.
}
// Handle any errors that may have occurred.
catch (SQLException e) {
e.printStackTrace();
}
}
}
I've seen this error related to web sites or Twitter APIs, but not just for connecting to SQL Server using the JDBC official driver. Any idea of how to fix it? I've tried a lot of things and nothing seems to work.