Published 2025-04-22
tag(s): #link-post #programming
This is a follow up to yesterday's (hate-filled) rant about SAP downloads and the Sybase ODBC driver.
Today I had to connect to MSSQL, and the Linux server users FreeTDS.
Rather than change the connection to test locally (so it uses the MSSQL native driver), I
decided that this was a fateful sign that I should get FreeTDS installed in Windows, and then
I could use it for Sybase too.
I am comfortable compiling whatever in Windows, but I figured there had to be a readily
available driver already...and there was, but it took me a while to find one that worked.
Actually, I wasted enough time finding it, that I wonder if compiling wouldn't had been
easier. Anyway, I don't know how many people read this site, or if this post will get indexed,
but if anything, writing this is good documentation for myself[1].
Credit goes to this post by Nick Vasile. Since I couldn't find his email (a sin, I know), I couldn't send him a thank you note.
If you don't compile the driver yourself, a good alternative is using the drivers linked in Nick's post, they are right here (and the person that set that up will get a thank you email ☺️). I got the latest version for x64, unzipped, move to a suitable location and then, in an Administrator Terminal:
C:\Users\MyUserName\home\freetds>cd bin
C:\Users\MyUserName\home\freetds\bin>dir
Directory of C:\Users\MyUserName\home\freetds\bin
04/22/2025 10:54 AM .
04/22/2025 10:54 AM ..
04/22/2025 02:08 AM 30,208 bsqldb.exe
04/22/2025 02:08 AM 24,576 bsqlodbc.exe
04/22/2025 02:07 AM 346,112 ct.dll
04/22/2025 02:08 AM 24,064 datacopy.exe
04/22/2025 02:08 AM 27,648 defncopy.exe
04/22/2025 02:08 AM 22,528 freebcp.exe
09/03/2024 09:13 AM 5,170,176 libcrypto-3-x64.dll
09/03/2024 09:13 AM 778,240 libssl-3-x64.dll
04/22/2025 02:07 AM 398,848 sybdb.dll
04/22/2025 02:07 AM 457,728 tdsodbc.dll
04/22/2025 02:08 AM 235,520 tdspool.exe
04/22/2025 02:08 AM 257,536 tsql.exe
12 File(s) 7,773,184 bytes
2 Dir(s) 1,740,541,038,592 bytes free
C:\Users\MyUserName\home\freetds\bin>regsvr32 tdsodbc.dll
Don't tell me regsvr32
isn't a blast from the past! Hadn't seen that old friend
in a long time. You can confirm it worked when you open "ODBC Data Sources" (which bitness
depends on whether you installed the 32bit or 64bit driver), and in the "Drivers" tab you see
FreeTDS:
I use my own database CLI tool (long
story)[2], and I added a --list-drivers
flag to test this kind of thing.
Funnily, this flag was more about Linux than Windows: if you add a driver to `odbcinst.ini`
but mess up a parameter, the driver is not "installed", and this helps diagnose those issues:
C:\Users\MyUserName\home\freetds\bin>datum --list-drivers
Drivers available:
"SQL Server"
"ODBC Driver 18 for SQL Server"
"ODBC Driver 17 for SQL Server"
"MySQL ODBC 8.4 ANSI Driver"
"MySQL ODBC 8.4 Unicode Driver"
"SnowflakeDSIIDriver"
"Oracle in oracle"
"Microsoft Access Driver (*.mdb, *.accdb)"
"Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)"
"Microsoft Access Text Driver (*.txt, *.csv)"
"Microsoft Access dBASE Driver (*.dbf, *.ndx, *.mdx)"
"FreeTDS"
C:\Users\MyUserName\home\freetds\bin>
Yay! FreeTDS
is there! I ran the tests against MSSQL, and then...
While these notes are specific to using Datum (yes, more shameless plugs!), the information for the connection string is the same in all contexts. Pretty standard stuff:
datum --driver FreeTDS --user le_username --pass very-secret --server 100.100.100.100,5000 --database northwind
Biggest thing to note is that I still haven't added support for --port
(or
documented that it won't be ever supported). But FreeTDS, just like the MSSQL drivers,
conveniently allows specifiying the port with a comma after the server address/name.
Now I just hope a sales person from SAP contacts me so I tell them how much I don't need them. That will show them! (????????????????????????)
Years later, SAP was still printing money, and Hoagie still naively believed that
companies should care about the developer experience and building good products - despite
Sharepoint-sized mountains of evidence that all that matters is selling your product to the
right audience.
Usually people that pay for it, and not people that use it.
Then he filled a time sheet in Peoplesoft, logged a vacation request in Workday, and left
for the day.
The (sad) end.