Sql Server Odbc Driver For Mac

The following instructions assume you already have a SQL Server database running somewhere that your Mac has network access to. Just FYI, Microsoft's instructions for installing the latest drivers are here.

Mac OS X client access to Microsoft SQL Server, MySQL, Oracle, PostgreSQL, and Sybase Support for all network protocols and server operating environments, which are supported by the database vendors' communications products. ODBC driver for SQL Server can be used with 32-bit and 64-bit applications on both x32 and x64 platforms, so there is no need to additionally configure the driver, applications or environment. Fully Unicode Driver. I'm going crazy trying to find a FOSS free (doesn't have to be open source) ODBC driver to connect to an MS SQL Server. While it doesn't strictly have to be free (which is a huge plus, for obvious reasons), the drivers I have found haven't had an easy to find price tag.

Install FreeTDS and unixODBC

The connection to SQL Server will be made using the unixODBC driver manager and the FreeTDS driver. Installing them is most easily done using homebrew, the Mac package manager:

  • The Actual SQL Server ODBC Driver lets you access your company's Microsoft SQL Server and Sybase databases from within Microsoft Excel and FileMaker Pro.
  • Devart ODBC Driver for SQL Server provides high-performance and feature-rich connectivity solution for ODBC-based applications to access SQL Server databases from Windows, Linux and Mac OS X.

Edit the freetds.conf configuration file

SQL Server ODBC Driver for Mac Unicode enabled 32/64-bit ODBC Driver for Mac. Connect to any SQL Server compatible database from popular Mac applications like FileMaker Pro and Office for Mac.

Ensure the freetds.conf file is located in directory /usr/local/etc/, which will be a symlink to the actual file as installed by Homebrew. Check the specific location of the freetds.conf file by running tsql -C. The default file already contains a standard example configuration, but all you need to do is add your server information to the end, as follows:

There are other key/value pairs that can be added but this shouldn't usually be necessary, see here for details. The host parameter should be either the network name (or IP address) of the database server, or 'localhost' if SQL Server is running directly on your Mac (e.g. using Docker). A TDS version of 7.3 should be OK for SQL Server 2008 and newer, but bear in mind you might need a different value for older versions of SQL Server. For more information on TDS protocol versions see Choosing a TDS protocol version. Do not use TDS versions 8.0 or 9.0 though. Oddly, they are not newer than version 7.4. They are actually obsolete aliases for older TDS versions and their use is discouraged.

Test the connection using the tsql utility, e.g. tsql -S MYMSSQL -U myuser -P mypassword. If this works, you should see the following:

At this point you can run SQL queries, e.g. 'SELECT @@VERSION' but you'll need to enter 'GO' on a separate line to actually execute the query. Type exit to get out of the interactive session.

Edit the odbcinst.ini and odbc.ini configuration files

Run odbcinst -j to get the location of the odbcinst.ini and odbc.ini files (probably in the directory /usr/local/etc/). Edit odbcinst.ini to include the following:

Edit odbc.ini to include the following:

Note, the 'Driver' is the name of the entry in odbcinst.ini, and the 'Servername' is the name of the entry in freetds.conf (not a network name). There are other key/value pairs that can be included, see here for details.

Check that all is OK by running isql MYMSSQL myuser mypassword. You should see the following:

You can enter SQL queries at this point if you like. Type quit to exit the interactive session.

Connect with pyodbc

It should now be possible to connect to your SQL Server database using pyodbc, for example:

Active4 years, 5 months ago

I'm going crazy trying to find a FOSS free (doesn't have to be open source) ODBC driver to connect to an MS SQL Server. While it doesn't strictly have to be free (which is a huge plus, for obvious reasons), the drivers I have found haven't had an easy to find price tag.

Does anyone know of any preferably free, and if not free, then relatively (sub $30, since it's just for the random times I might need it) cheap drivers for ODBC - MS SQL on OS X?

Thanks!

Sql server odbc driver for windows 7
tjsimmons
tjsimmons

Actual Odbc Sql Server Driver For Mac

tjsimmons
4284 gold badges9 silver badges21 bronze badges

4 Answers

unixODBC + FreeTDS is one way: http://www.freetds.org/ & http://www.unixodbc.org/

Adam VandenbergAdam Vandenberg
14.8k5 gold badges45 silver badges51 bronze badges

Here's a random extract from Microsoft Office support:

Microsoft Sql Server Odbc Download

If you want to import data into Excel for Mac from a database, you must first install compatible Open Database Connectivity (ODBC) drivers — software that Excel can use to access your database server. ODBC drivers that are compatible with Excel for Mac are available from the following third-party vendors:

Gilles
79.7k19 gold badges171 silver badges209 bronze badges
user1089766user1089766

Have you looked at the OpenLink Express Driver for SQL Server on Mac OS X? (Registration required.)

trashgod

Best Sql Server Driver For Odbc

190k18 gold badges155 silver badges763 bronze badges

Sql Server Odbc Driver For Mac

hwilliamshwilliams

Have you looked at Mdblite on AppStore?

Install Sql Server Odbc Driver Mac

AcacioAcacio

Sql Server Odbc Driver For Mac

Not the answer you're looking for? Browse other questions tagged sql-servermacosodbc or ask your own question.