SQL server connections on Linux
antonio last edited by
I've worked with sql server on Windows without problems, but I try to use the same code with linux, I can't make connections.
There are special configurations or additional libraries to make it work?
Where's your sql server located ? How do you access it ?
hskoglund last edited by
It is possible to do in Qt, but not as simple as on Windows :-)
FIrst problem is for some reason the Qt dll for ODBC is not included on Linux, i.e. there is no ~/Qt/5.2.1/gcc_64/plugins/sqldrivers/libqsqlodbc.so
This means you have to download Qt and compile it for yourself, I did it last week with some good help from this forum.
2nd problem is the ODBC driver and TSQL driver files. Basically for Linux and Mac there are two choices, unixodbc and iodbc. I sat one night trying to get unixodbc to work with Qt but no dice. iodbc worked better, so now i have a /usr/lib/libiodbc.so (which libqsqlodbc.so wants). Then I downloaded the freetds package and built the file /usr/local/lib/libtdsodbc.so.0.0.0 (which is pulled in by .odbc.ini).
3rd problem is that you cannot use a DSN-less connection, you have to write 2 small files in your ~ directory: .odbc.ini and freetds.conf
Anyway, it took me a couple of nights, but now I have a working Qt program on my Ubuntu 13.10 that reads the Northwind database on my SQLServer2008 :-)
I've been meaing to write a blog post about this "on my blog":http://tripleboot.org but laziness is a powerful force..