Sql-server – The TCP/IP connection to the host, port 1433 has failed

jdbcsql servertcp

I am new to JDBC connections and I am very confused. I have enable TCP/IP and Named Pipes and in TCP/IP -> IP Adresses I have set TCP port to 1433 and I have restarted the server. I have also open access to SQL Server via Windows Firewall with Advanced Security. The problem is that I still get this error:

SQLException: The TCP/IP connection to the host MSSQL$SQLFULL, port
1433 has failed. Error: "null. Verify the connection properties, check
that an instance of SQL Server is running on the host and accepting
TCP/IP connections at the port, and that no firewall is blocking TCP
connections to the port."

I run on cmd the following: telnet SQLFULL 1433 and I get this message:
Could not open connection to the host on port 1433 : connect failed

My code:

String url = "jdbc:sqlserver://MSSQL$SQLFULL:1433;databaseName=BA_ELTRUN;";
Connection dbcon = null;
String errorMessages = "";

try
{
    Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
}
catch(java.lang.ClassNotFoundException e)
{
    System.out.print("ClassNotFoundException: ");
    System.out.println(e.getMessage());
}

try
{
    dbcon = DriverManager.getConnection(url,"username","password");
}
catch(SQLException e)
{
     System.out.print("SQLException: ");
     System.out.println(e.getMessage());
     errorMessages = "Could not close connection with the Database Server: <br>"
                    + e.getMessage();
                    throw new SQLException(errorMessages);
}

Can anyone help?

Best Answer

Copy computer name :cmd.exe -> hostname

or

Right Click on Start then click on System and copy the Computer Name

URL should be:

String url = "jdbc:sqlserver://<Computer Name>\\SQLFULL:1433;databaseName=BA_ELTRUN;";

Connection conn = DriverManager.getConnection(url,"<user>","<password>"):