macosmacportsfreetdsunixodbc

ODBC Driver Manager: Data source name not found and no default driver specified


I am setting up Go, FreeTDS, and unixODBC on OSX. I followed the instructions on https://code.google.com/p/odbc/wiki/InstallingUnixODBCOnOSX, and when I tried to run the tests, I get:

[ODBC Driver Manager] Data source name not found and no default driver specified

The port installs both unixODBC and FreeTDS, so what is needed to resolve this problem?


Solution

  • In Linux you use odbcinst to register the data source, but you need to know where libtdsodbc.so is

    On my Mac, it was put in

    /opt/local/lib/libtdsodbc.so
    

    If that's not where yours was installed, do this to find its location:

    sudo find / -name "libtdsodbc.so"
    

    Then create a file called "tds.driver.template" with the following inside:

    [FreeTDS]
    Description = Open source FreeTDS Driver
    Driver =/opt/local/lib/libtdsodbc.so
    

    Then run

    sudo odbcinst -i -d -f tds.driver.template