I want to use two separate databases over ODBC in my application.
If I do something like this:
db_serno.setDatabaseName("AccDB");
db_serno.open();
db_serno.exec(<SQL_QUERY>); <-- query performs successfully
db
=QSqlDatabase::addDatabase("QODBC");
// trying to add another ODBC connection to another DB
db_serno.exec(<SQL_QUERY>); <-- query fails (last error is: Driver not loaded)
db_serno=QSqlDatabase::addDatabase("QODBC");
db_serno.setDatabaseName("AccDB");
db_serno.open();
db_serno.exec(<SQL_QUERY>); <-- query performs successfully
db=QSqlDatabase::addDatabase("QODBC"); // trying to add another ODBC connection to another DB
db_serno.exec(<SQL_QUERY>); <-- query fails (last error is: Driver not loaded)
To copy to clipboard, switch view to plain text mode
It seems that second addDatabase() somehow corrupts also the first odbc object. Obviously I am doing something wrong, how can I fix it?
Bookmarks