QT: 4.7 commercial
OS: Windows 7
IDE: QT Creator 2.0.1
Installed using QT SDK 2010.05

I am using a console application and the QT ODBC driver to connect to and append an Access database file. The db open() and query exec() methods return "true". However, the data does not appear in the database. When the main function returns, a segmentation fault occurs in the ODBC driver code at SQLDisconnect.

Connection code:
Qt Code:
  1. static bool connectToDB() { static QSqlDatabase db = QSqlDatabase::addDatabase("QODBC"); QString sDBFile = "S:/Current_b416net.mdb"; QString sDBDriver = "DRIVER={Microsoft Access Driver (*.mdb)};FIL={MS Access};DBQ=" + sDBFile; db.setDatabaseName(sDBDriver); return db.open(); }
To copy to clipboard, switch view to plain text mode 

Connection usage:
Qt Code:
  1. if (!connectToDB()) [COLOR=red]<---Returns true.[/COLOR]
  2. { Logger("Unable to connect to Database."); return 3; }
To copy to clipboard, switch view to plain text mode 

Query Code:
Qt Code:
  1. QString sQTxt = "INSERT INTO log \n" "(index, system, \n" " event, log) \n" "VALUES ('" + sIndex + "', '" + sIP + "', \n" " '" + sType + "', '" + sMessage + "')"; Logger(sQTxt); QSqlQuery qEvent; if (!qEvent.exec(sQTxt)) { Logger("... Query for event insertion failed."); Logger(qEvent.lastError().text()); Logger(sQTxt); qEvent.clear(); return false; } else { cvtLogger("... Query successful."); [COLOR=red]<-- Code takes this branch.[/COLOR] qEvent.clear(); return true; }
To copy to clipboard, switch view to plain text mode 

The segmentation fault occurs as the main function returns. The IDE jumps to this location in qsql_odbc.cpp:
Qt Code:
  1. // Open statements/descriptors handles are automatically cleaned up by SQLDisconnect if (isOpen()) { r = SQLDisconnect(d->hDbc); [COLOR=red]<---- Current line is here.[/COLOR] if (r != SQL_SUCCESS) qSqlWarning(QLatin1String("QODBCDriver::disconnect: Unable to disconnect datasource"), d); else d->disconnectCount++; }
To copy to clipboard, switch view to plain text mode 

Anybody have some experience that might help me?

Karl