Reputation: 5903
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?
Upvotes: 2
Views: 4420
Reputation: 1972
I was running into this issue, and I think what fixed it was setting the ODBCSYSINI
and ODBCINI
environment variables (credit to this answer). For Mac, you need to set them to these values:
export ODBCSYSINI=/Library/ODBC
export ODBCINI=/Library/ODBC/odbc.ini
Upvotes: 0
Reputation: 55563
In my opinion, the best way to do is to use a DSN-less configuration — when you encode full information required to connect to a server instance in the ODBC connection string. The upside of this approach is that it requires exactly zero configuration of the client machine, other than making sure the FreeTDS
ODBC
driver is properly installed.
Note two caveats applicable to FreeTDS
in this sort of setup though:
Port
connection string key. It's typically 1433
if you're connecting to a Microsoft® SQL Server™.FreeTDS has an insanely low default TDS protocol version — something like 5.0.
To override this, you have to use the TDS_Version
connection string key. Either set it to auto
or to a some sensible value:
Looks like 7.2 is the largest TDS protocol version currently supported by FreeTDS
but actually 7.2 is more than enough to work with typical data types, including varbinary(max)
.
Upvotes: 4
Reputation: 5903
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
Upvotes: 2