2

I'm trying to connect to Microsoft SQL Server from my Mac application using iODBC and FreeTDS. No matter what I do, I get the error message Unable to connect to data source from the FreeTDS driver. i have consulted as many possible manuals, blog posts, and StackOverflow questions.

Following is the troubleshooting steps i tried and more details about my code,

DB Connection string = Driver=/Applications/xxx.app/Contents/Frameworks/libtdsodbc.so;Server=ip;DATABASE=DB;TDS_Version=8.0;Port=1433;ClientCharset=UTF-8;uid=username;pwd=*****;Trusted_Connection=No;

From application logs,

SQLGetDiagRec function returns
[01000] [FreeTDS][SQL Server]Adaptive Server connection failed (20002)
[08001] [FreeTDS][SQL Server]Unable to connect to data source (0)

Few StackOverflow post's suggested this is due to TDS version and changing to 8.0 would help but its already set.

When I ping the server - no packets are lost. Connection is established when i telnet the server on 1433 port.

Using the below i am able to establish connection too,

tsql -H >IP< -p 1433 -U username -P password

In this particular post as per the comments by Max Bolingbroke if SERVER attribute is used then freetds.config and odbc.ini are ignored. So i guess the config file parameters dont help much.

Could anyone please provide me with some pointers or any help so i can proceed further.

Community
  • 1
  • 1
OzWin
  • 21
  • 2
  • A few things. Consider using unixODBC; this answer gives some good reasons why: http://stackoverflow.com/questions/7548825/what-are-the-functional-differences-between-iodbc-and-unixodbc `TDS_Version` 8.0 doesn't exist; try 7.2 if you're on SQL Server 2008: http://www.freetds.org/userguide/choosingtdsprotocol.htm – FlipperPA Mar 26 '16 at 20:31
  • One thing i missed out in my post is that the connection works for most of the environment setups except a few with similar configurations. Is there any way to find why those few are not able to connect ? @FlipperPA i will try out your suggestion to changing the version to 7.2 but using unixODBC at this point would not be possible as the application is already in production environment. – OzWin Mar 28 '16 at 06:00

0 Answers0