Skip to content
Advertisement

TCP/IP connection to the host localhost port 1487 has failed – Linux 32 bit

I try to connect to a mySql localhost database. I checked the port 1487 and is open for connection. Many solutions suggest to open SQL Server Configuration Manager, but there is no such thing in Ubuntu 14.04. I tried to install Microsoft ODBC Driver 11 for SQL Server on Linux, but it’s only for 64 bit systems. I use eclipse to write my java code:

    String dbURL = "jdbc:sqlserver://localhost:1487;user=sa;password=1234";
    conn = DriverManager.getConnection(dbURL);
    if (conn != null) {
             System.out.println("Connected");
    }

Error:

com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host SQL2008, port 1487 has failed. Error: "null. 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.

Advertisement

Answer

SQL Server is a database produced by Microsoft based on a Sybase database. I believe these have compatible SQL connectors. Note: I don’t believe SQL Server runs on Linux.

However, MySQL is a completely different database. As such I suggest using the MySQL JDBC drivers, or the MariaDB Connector/J and URL to connect to MySQL as this is more likely to work.

See https://dev.mysql.com/doc/connector-j/en/connector-j-usagenotes-connect-drivermanager.html

The example it gives is

conn =
   DriverManager.getConnection("jdbc:mysql://localhost/test?" +
                               "user=minty&password=greatsqldb");

Note: how this mentions mysql not sqlserver

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement