Reputation: 3635
I am having issue with unixODBC. I need multiple connections to different Sql server instances and all of them are working except one. It has additional parameter in host.
All host are ip or just host name, but one which is ont working has IP\smth
I have tried:
Description=Microsoft ODBC Driver 13 for SQL Server
Driver=/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.0.so.0.0
Database=dbname
Server=192.168.1.1/PARAM
Port=1433
Also tried escaping, quotes, etc.
isql -v
returns:
[S1T00][unixODBC][Microsoft][ODBC Driver 13 for SQL Server]Login timeout expired
[08001][unixODBC][Microsoft][ODBC Driver 13 for SQL Server]MAX_PROVS: Error Locating Server/Instance Specified [xFFFFFFFF].
[08001][unixODBC][Microsoft][ODBC Driver 13 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.
[ISQL]ERROR: Could not SQLConnect
Upvotes: 4
Views: 6488
Reputation: 8780
I could connect from MAC OSX (Sierra) via unixODBC to SQL Server 2017 (installed in a docker container using this image: https://hub.docker.com/r/microsoft/mssql-server-linux/) by following these steps:
Install the ODBC driver as described here: https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server
Find out in which odbc.ini config file the system DSNs are stored and where to find the ODBC driver name:
odbcinst -j
...
DRIVERS............: /usr/local/etc/odbcinst.ini
SYSTEM DATA SOURCES: /usr/local/etc/odbc.ini
...
Remember the exact driver name from the odbcinst.ini file (preconfigured from the driver installation from step 1):
...
[ODBC Driver 13 for SQL Server]
...
Edit the odbc.ini file and add a DSN to your database (all allowed keywords are described here: https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/connection-string-keywords-and-data-source-names-dsns):
...
[MSSQLTest]
Driver = ODBC Driver 13 for SQL Server
Server = 192.168.178.1,1433
...
Note: Use your server IP address (or server name) and port number here.
Test the connection (it should work now):
isql MSSQLTest sa Password12345 -v
Note: Replace the user name "sa" and the password "Password12345" with your own credentials!
You should see then:
Connected!
Enjoy your hot caffeinated beverage ;-)
Upvotes: 3