« A trip with the cable… | Home | MBS Filemaker Plugin,… »

Tip of the day: Connect to MS SQL Server from Mac without ODBC setup

You can always connect via ODBC on a Mac with setting up an ODBC driver for MS SQL. But using the freetds open source library, we can actually connect from Xojo or FileMaker to the MS SQL Server without a special setup.
  • you get the freetds library, e.g. precompiled from our website
  • you start a SQL Connection
  • you set the OptionLibraryODBC with the file path to the library.
  • you use an ODBC connecting string like "DRIVER={FREETDS" + pathToLib + "};Server=192.168.2.32;UId=SA;PWD=manager;Database=test;TDS_VERSION=7.2;Port=1433".
That should work. Of course firewall must let the port open and your server actually must be configured to use this port (or some other).

Update for Xojo:
If you want to place the libtdsodbc.dylib into the Apps Resources Folder (Mac) within the Bundle, add a Build Step to copy the File (Build & Debug Mode) to the Resources Folder and use the following code to access it:

dim libtdsodbc as FolderItem
libtdsodbc = App.ExecutableFile.Parent.Parent.Child("Resources").Child("libtdsodbc.dylib")
01 07 14 - 14:16