I have been using MySQL up till now, but how would I connect to SQLServer? Should I use
qx::QxSqlDatabase::getSingleton()->setDriverName("QSQLITE"); ?
Or is there a way to use ODBC ?
how would I connect to SQLServer? ...
... Or is there a way to use ODBC ?
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);
QSqlDatabase: QODBC driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL3 QMYSQL
...
Do I need to rebuild QxOrm? What else needs to be done?
cd $QTDIR/src/plugins/sqldrivers/odbc
qmake "INCLUDEPATH+=/usr/local/unixODBC/include" "LIBS+=-L/usr/local/unixODBC/lib -lodbc"
make
I have downloaded qt and built the sql driver plugin libqsqlodbc.so and installed/copied into the /usr/lib64/qt4/plugins/sqlddrivers/.
Now what should be done so that the odbc qt plugin is loaded? Its still not picking it up.
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);
qx::QxSqlDatabase::getSingleton()->setDatabaseName("DSN_TEST");
Now, it looks more like a programmatical issue
I may also be missing something with the above (sqlGenerator) ?
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
Yes, it was an OBDC configuration. Thank you.
Users browsing this forum: No registered users and 4 guests