I am working on a GUI application that will be used to perform “manual assessment” of large datasets produced by an AI algorithm. The nature of the assessment isn’t important to this question; only the fact that the program will need to periodically check for new data from a server, download it, and then upload the results that the user produces. Each dataset is just a binary blob, as far as this question is concerned.
The machine that will host the data is currently set up with Microsoft SQL Server. For administrative reasons, I’ll probably have to use SQL Server (rather than the web server that’s running on the same machine) to store the data. I know SQL, and I doubt I’ll have trouble learning Microsoft’s version of it.
Here’s the hard part: The program needs to run on Mac OS X and Windows. I don’t have much experience with Windows development, and do most of my coding on a Mac using XCode — with a cross-compiler and a Windows VM to compile/test the Windows version. (However, I’ve already got the GUI working on Windows so that isn’t the issue here. The code is in Objective-C but I’m happy to use pure C, or even C++, to access the database.)
The program just needs to connect to the SQL Server and perform simple queries. I’d really like a library that I can just link into my application so that it can do its thing — sort of I can with SQLite, but I’d obviously be passing a connection string rather than a database filename. I’d prefer for the end-user not to have to install anything extra on their machine. Here’s what I’ve found so far:
- Microsoft Data Access Components‘ ODBC interface — Windows only, and the latest version was released in 2005 which makes me wonder whether or not it supports to latest version of SQL Server.
- iODBC — runs on practically everything except Windows.
- FreeTDS — accesses SQL Server through the native protocol rather than through ODBC. Claims to run on “Linux/UNIX”, but I was able to compile it on OSX without any problems.
The last two are open-source. A quick look at the code shows that FreeTDS uses BSD sockets for connecting to the server (I haven’t figured out yet what IODBC uses, but probably the same), and I can’t see why any other part of the code would be non-portable. If necessary, I would be prepared to try porting the FreeTDS socket code to Winsock, if I could be fairly sure that I wouldn’t run into any further obstacles.
My question is:
Can I get one of these libraries (or anything else, for that matter) to link against both the Mac and Windows versions of my application?
If not, what’s the best combination of libraries to use to ensure minimum hassle? In either case, are there any gotchas I need to know about when distributing the Windows version, such as DLLs that will need to be installed on users’ machines?
Update:
On @TomTom’s recommendation, I’m going to try FreeTDS. Despite what I initially thought, it does compile on Windows, and it seems that using a native implementation of TDS is considered better than ODBC, which is apparently 10 years out of date.
Well, ODBC in general is outdated / semi-retired (for about 10 years, in case you wonder) and replaced b a faster / more easy to handle technology clled OleDb.
That said, forget it – go for a TDS implementation and be happy with it.