ODBC on Linux

These notes were provided by Ben Buckley.

I just finished setting up ODBC on my Linux Mint 20.04 machine and was able to run your sample code successfully. I wanted to share a few articles that were immensely helpful. Configuring the DSN is a little obscure and, in fact, requires editing text configuration files. It looks like there's an abandoned GUI out there, but not packaged for any modern distros.

This has copy-pastable, distro-specific terminal commands for installing the MS driver:

https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15#ubuntu17

This article is a slightly-too-brief how-to setup the DSN. It gives the basic format of the odbc.ini file, not much direction to the parameters:

https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/connection-string-keywords-and-data-source-names-dsns?view=sql-server-ver15

This article has more than you want to know about odbc.ini. It's safe to ignore all the talk of template files and just directly edit odbc.ini. I'd recommend folks use ~/.odbc.ini so they don't leave any cruft in their system-wide settings:

http://www.unixodbc.org/odbcinst.html

My ~/.odbc.ini looks like:

    [VariableStars]
    Driver      = ODBC DRIVER 17 for SQL Server
    Server      = algol.database.windows.net
    UserName    = student
    Password    = *******
    Database    = VariableStars
    

Last Revised: 2025-01-09
© Copyright 2025 by Peter Chapin <peter.chapin@vermontstate.edu>