I'm attempting to connect to a SQL Server 2005 DB from my Mac using unixODBC and FreeTDS as I have outlined here. However, when I try to connect in to a different DB using the same setup, I get:
Connection Failed:[FreeTDS][SQL Server]Unable to connect: Adaptive Server is unavailable or does not exist.
Here is my freetds.conf setup:
[my_db]
host = 12.34.56.789
port = 1433
tds version = 8.0
And here is my odbc.ini:
[my_dsn]
Driver = /opt/local/lib/libtdsodbc.so
Description = My Database
Trace = no
Servername = my_db
Database = MyDB
[ODBC Data Sources]
my_dsn = FreeTDS
I am still able to connect to the other DB I set up on this computer (described in my blog post linked above), so I'm pretty sure that the error isn't on the Mac end. I've verified on the server that I'm using the correct IP address and port. Any thoughts on what could be the problem, and if it's on the server end?
It sounds like you have a problem with your dsn or odbc data source.
Try bypassing the dsn first and connect using:
If that works, you know its an issue with your dsn or with freetds using your dsn. Also, it is possible that your tds version is not compatible with your server. You might want to try other TDSVER settings (5.0, 7.0, 7.1).
After countless hours of frustration I managed to get all working:
odbcinst.ini:
odbc.ini:
FreeTDS.conf:
First test connection (mssql is a section name from freetds.conf):
You must see some settings but no errors and only a 1> prompt. Use quit to exit.
Then let's test DSN/FreeTDS (test is a section name from odbc.ini; -v means verbose):
You must see message Connected!
Bud, disable selinux or add the following to your RedHat/CentOS Server:
Best always!
1. See information about the SQL server
2. Set your freetds.conf
3 Try
OR
See also http://www.freetds.org/userguide/confirminstall.htm (Example 3-5.)
I've found an issue happen to be with the Firewall. So, make sure your IP is whitelisted and the firewall does not block your connection. You can check connectivity with:
In my case, the output was:
I had the same issue, my problem was that the firewall on the server wasn't open from the current ip address.