Connect to MS SQL Server through ODBC
I have a Qt 4 application that is trying to connect to an MS SQL Server 2008 database using the Qt ODBC driver. The application runs fine when it is running in Windows; however, the target OS for the application is to have it run in GNU/Linux. When the application runs in GNU/Linux I get the following error:
QSqlError(0, "QODBC3: Unable to connect", " [unixODBC][Driver Manager]Data source name not fou开发者_运维技巧nd, and no default driver specified")
Is there something I need to configure on the SQL server or application side to get the connection to work?
I don't really know much about unixODBC, but have a look here:
unixodbc.org/doc/
For connecting to MSSQL, the following might be useful:
http://www.unixodbc.org/doc/FreeTDS.html
or .../FreeTDS2.html
Try to copy the odbc.ini
file in ~/.odbc.ini
. If not working again, try to copy the same file into /etc/odbc.ini
. If this is not working, as these directories are different for different Unix systems, find all files: *odbc*\.ini
and see if some of them are empty. If so, replace them with the correct .ini
file.
I had the same problem and this solved it. But it's a really stupid solution, so I'm looking for a better one. Hope that helped (:
精彩评论