I'm trying to connect to a MS SQL server from a Linux machine, but can't get ODBC to work.
The following command works and I get a shell:
sqlcmd -S tcp:<servername>,<dynamic port> -U <SQL username> -P <SQL user password>
I have the following in my ODBC.ini file
[example]
Driver = ODBC Driver 17 for SQL Server
Server = <servername>
Port = <dynamic port>
User = <SQL username>
Password = <SQL user password>
As of my understanding this command should give the same results as the one earlier:
sqlcmd -D -S example
But I get the following error
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 0x2749.
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..
Additional info:
[user@server ~]$ odbcinst -j
unixODBC 2.3.7
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /home/ictadmin/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
[user@server ~]$ cat /etc/odbcinst.ini
[ODBC Driver 17 for SQL Server]
Description=Microsoft ODBC Driver 17 for SQL Server
Driver=/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.10.so.1.1
UsageCount=1