public class RDF2Connection {
static Connection connection=null;
final static String connectionUrl = "jdbc:sqlserver://DESKTOP-Q5K9FE6:1433;" +
"databaseName=RDFDB;";
public static Connection getRdf2Connected(){
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
connection = DriverManager.getConnection(connectionUrl, "sa", "root");
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
return connection;
}
}
com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host DESKTOP-Q5K9FE6, 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.". at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:206) at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.java:257) at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2385) at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:567) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1955) at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:1616) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1447) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:788) at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1187) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:247) at com.rdf2.databaseconnection.RDF2Connection.getRdf2Connected(RDF2Connection.java:22) at MainClass.main(MainClass.java:53) java.lang.NullPointerException at MainClass.main(MainClass.java:54)
Process finished with exit code 0