QODBC Driver not loaded after successfull connection and query
Hello everbody,
i have a strange situation/behaviour with the QODBC driver.
I've deployed the application with all the release-libraries (Windows 7 x32).
When i do a simple QSqlDatabase connect with the QODBC driver, everything works well, including a QSqlQuery task.
Code:
myDb.setDatabaseName("my odbc connection string");
if (!myDb.open()) {
qDebug() << myDb.lastError().text();
}
// do query and other funny things like int omg = 12/0;
But .. when i do the exact same thing a second time at runtime, i get a "DRIVER NOT LOADED. DRIVER NOT LOADED." error.
When i restart the application i get the excat behaviour again: SUCCESS; then FAIL; FAIL; FAIL...
To be honest i dont really know how to isolate the problem.
Anyone has an idea why this might occur?
Re: QODBC Driver not loaded after successfull connection and query
Try this:
Code:
if ( ! db.isOpen() )
{
if ( ! db.open() )
{
qWarning();
}
}
Re: QODBC Driver not loaded after successfull connection and query
Thank you for your answer,
but nevermind... i found the problem.
The second QSqlDatabase instance was created with the same **:mad:** connectionName.
I have no idea how this could result in an error like "Driver not loaded" but hey it's working now.'
yay!