Ok, I installed the linux qt-odbc package (instead of having to build the plugin).
Now, it looks more like a programmatical issue -
[QxOrm] qx::QxSqlDatabase : 'unable to open connection to database'
Error number '0' : [unixODBC][Driver Manager]Data source name not found, and no default driver specified QODBC3: Unable to connect
QODBC3: Unable to connect
[unixODBC][Driver Manager]Data source name not found, and no default driver specified
Here is the code:
- Code: Select all
qx::QxSqlDatabase::getSingleton()->setDriverName("QODBC");
qx::dao::detail::QxSqlGenerator_MSSQLServer_ptr pSqlGenerator =
qx::dao::detail::QxSqlGenerator_MSSQLServer_ptr(new qx::dao::detail::QxSqlGenerator_MSSQLServer());
qx::QxSqlDatabase::getSingleton()->setSqlGenerator(pSqlGenerator);
qx::QxSqlDatabase::getSingleton()->setDatabaseName("dbTest");
qx::QxSqlDatabase::getSingleton()->setHostName(ip);
qx::QxSqlDatabase::getSingleton()->setUserName(user);
qx::QxSqlDatabase::getSingleton()->setPassword(pw);
How do I specify the data source name? I may also be missing something with the above (sqlGenerator) ?
Thanks.
EDITIf I change the setDatabaseName() to use the DSN entry in odbc.ini like so:
- Code: Select all
qx::QxSqlDatabase::getSingleton()->setDatabaseName("DSN_TEST");
Output:
[QxOrm] qx::QxSqlDatabase : 'unable to open connection to database'
Error number '10022' : [unixODBC][Microsoft][SQL Server Native Client 11.0]Login timeout expired [unixODBC][Microsoft][SQL Server Native Client 11.0]A network-related or
QODBC3: Unable to connect
[unixODBC][Microsoft][SQL Server Native Client 11.0]Login timeout expired [unixODBC][Microsoft][SQL Server Native Client 11.0]A network-related or
0
My
odbc.ini[DSN_TEST]
Driver=SQL Server Native Client 11.0
Server=172.19.1.xxx
Database=dbTestMy
odbcinst.ini[SQL Server Native Client 11.0]
Description=Microsoft SQL Server ODBC Driver V1.0 for Linux
Driver=/opt/microsoft/sqlncli/lib64/libsqlncli-11.0.so.1790.0
Threading=1
UsageCount=1Any ideas?