Hello,
In an application I am connecting to MS SQL Server from Mac using the libtdsodbc.dylib.
If the instance of SQL Server is not named (e.g. 192.168.1.163) it connects with no problem.
However if the instance is named (192.168.1.163\SQLEXPRESS) then it doesn’t connect with the following error:
08S01 [FreeTDS][SQL Server]Unable to connect: Adaptive Server is unavailable or does not exist08001 [FreeTDS][SQL Server]Unable to connect to data source
08S01 [FreeTDS][SQL Server]Unable to connect: Adaptive Server is unavailable or does not exist
Should I specify the instance name in some other way? Or is there something else wrong?
I don’t use instance or ‘ \SQLEXPRESS’ when connecting to MSSQL from a Mac and it works fine. If the database doesn’t exist yet (because I want to create it) then I leave '+ “;Database=” + myDatabaseName ’ out.
I have connected successfully to SQLServers with no instance name (e.g. 192.168.1.163).
The problem is if the instance is named (usually the instance name is sqlexpress if they use sqlexpress). In that case, I don’t seem to be able to connect.
However, I think that there should not be a problem, probably something needs to be passed to FREETDS differently ?!
I seem to have found a solution!
The solution concerns the port. So if the instance is named, the default port for SQL Server service is not set and what I needed to do is:
Open “Sql Server Configuration Manager”
Go to “SQL Server Network Configuration > Protocols for SERVER”
Right click “TCP/IP”, select “Properties”, go to the “IP Addresses” tab
Under “IPAll” set “TCP Port” to the desired port number (IPAII was the last in my setup)
Click OK, and restart the SQL Server service.
Then I could connect, either as 192.168.1.163\sqlexpress or as 192.168.1.163 (without the instance name).
It seems that the instance name is ignored, however, if the port is set correctly it connects!
Now there should be another way maybe, but this is a working solution (workaround).
normally the lib would connect to server, ask for port of the instance and than connect to that port.
So the instance name is just used to find the port.