I want to use two separate databases over ODBC in my application.

If I do something like this:

Qt Code:
  1. db_serno=QSqlDatabase::addDatabase("QODBC");
  2.  
  3. db_serno.setDatabaseName("AccDB");
  4.  
  5. db_serno.open();
  6. db_serno.exec(<SQL_QUERY>); <-- query performs successfully
  7.  
  8. db=QSqlDatabase::addDatabase("QODBC"); // trying to add another ODBC connection to another DB
  9.  
  10. 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?