0

If i try to connect to sqlcmd like this:

sqlcmd -S 127.0.0.1:1433 -U SA -P pass

I get ..

Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired. Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : TCP Provider: Error code 0x2AF9. Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..

I'm afraid my driver is not properly installed, I've been reading google information about this problem and nothing works, however

nc -z -v -w5 127.0.0.1 1433 Connection to 127.0.0.1 1433 port [tcp/ms-sql-s] succeeded!

..and tsql -S 127.0.0.1 -U SA Password: locale is "es_ES.UTF-8" locale charset is "UTF-8" using default charset "UTF-8" 1> ..also works.

systemctl status mssql-server --no-pager

$ systemctl status mssql-server --no-pager ● mssql-server.service - Microsoft SQL Server Database Engine Loaded: loaded (/lib/systemd/system/mssql-server.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2019-08-08 18:19:10 CEST; 3h 21min ago Docs: https://docs.microsoft.com/en-us/sql/linux Main PID: 25809 (sqlservr) Tasks: 154 CGroup: /system.slice/mssql-server.service ├─25809 /opt/mssql/bin/sqlservr └─25856 /opt/mssql/bin/sqlservr

ago 08 18:19:59 dpinalopez68-SATELLITE-C50D-A-12R sqlservr[25809]: [71B blob data] ago 08 18:19:59 dpinalopez68-SATELLITE-C50D-A-12R sqlservr[25809]: [162B blob data] ago 08 18:19:59 dpinalopez68-SATELLITE-C50D-A-12R sqlservr[25809]: [124B blob data] ago 08 19:03:34 dpinalopez68-SATELLITE-C50D-A-12R sqlservr[25809]: [96B blob data] ago 08 19:03:34 dpinalopez68-SATELLITE-C50D-A-12R sqlservr[25809]: [74B blob data] ago 08 19:03:34 dpinalopez68-SATELLITE-C50D-A-12R sqlservr[25809]: [68B blob data] ago 08 19:03:35 dpinalopez68-SATELLITE-C50D-A-12R sqlservr[25809]: [136B blob data] ago 08 19:03:35 dpinalopez68-SATELLITE-C50D-A-12R sqlservr[25809]: [111B blob data] ago 08 19:03:35 dpinalopez68-SATELLITE-C50D-A-12R sqlservr[25809]: [137B blob data] ago 08 19:03:35 dpinalopez68-SATELLITE-C50D-A-12R sqlservr[25809]: [112B blob data]

....and finally

sudo lsof -i -P -n | grep LISTEN [sudo] contraseña para dpinalopez68: systemd-r 909 systemd-resolve 13u IPv4 22378 0t0 TCP 127.0.0.53:53 (LISTEN) Plex\x20M 1908 root 60u IPv6 31648 0t0 TCP *:32400 (LISTEN) Plex\x20M 1908 root 61u IPv4 31650 0t0 TCP 127.0.0.1:32401 (LISTEN) smbd 2022 root 32u IPv6 32325 0t0 TCP *:445 (LISTEN) smbd 2022 root 33u IPv6 32326 0t0 TCP *:139 (LISTEN) smbd 2022 root 34u IPv4 32327 0t0 TCP *:445 (LISTEN) smbd 2022 root 35u IPv4 32328 0t0 TCP *:139 (LISTEN) Plex\x20S 2191 root 7u IPv4 34705 0t0 TCP 127.0.0.1:38271 (LISTEN) Plex\x20D 3555 root 15u IPv4 38184 0t0 TCP *:1573 (LISTEN) Plex\x20D 3555 root 33u IPv4 37458 0t0 TCP *:32469 (LISTEN) Plex\x20T 3574 root 13u IPv4 37432 0t0 TCP 127.0.0.1:32600 (LISTEN) cupsd 4881 root 6u IPv6 47176 0t0 TCP [::1]:631 (LISTEN) cupsd 4881 root 7u IPv4 47177 0t0 TCP 127.0.0.1:631 (LISTEN) code 14120 dpinalopez68 78u IPv4 441836 0t0 TCP 127.0.0.1:56103 (LISTEN) sqlservr 25856 mssql 171u IPv6 249437 0t0 TCP *:1433 (LISTEN) sqlservr 25856 mssql 172u IPv4 249438 0t0 TCP *:1433 (LISTEN) sqlservr 25856 mssql 176u IPv6 249441 0t0 TCP [::1]:1434 (LISTEN) sqlservr 25856 mssql 179u IPv4 249442 0t0 TCP 127.0.0.1:1434 (LISTEN)

Any help is appreciated. Thanks in advance

David

1

According to this, the proper way to explicitely set the port is -S [protocol:]server[instance_name][,port], not server:port as you are doing it.

Also, since 1433 is the default port, and on your other ways to test it, you're excluding it, you can also remove it on the sqlcmd options.

I think this is the case because the error says Server is not found or not accessible. Nothing about the driver, so the wrong syntax is making the search for the host unsuccessful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.