QODBC and unixODBC/mdbtools



  • Hello.

    The title says it all. I am trying to open an accdb file from qt in linux, so far , I've managed to get to the point where mdbtools can query the .accdb file, and it shows correct results so far. So, unixODBC is working fine.

    But, when trying to query it from qt, I only get errors, and more errors.

    The thing is something like this:

    @ QSqlDatabase *import = new QSqlDatabase;
    *import = QSqlDatabase::addDatabase("QODBC", "IMPORT");
    import->setDatabaseName("kook");
    ...
    if(!import->open())
    {
    qDebug() << Q_FUNC_INFO << "failed to open import database";
    return false;
    }
    else
    {
    qDebug() << "database was downloaded, open, and it is ready to be imported";
    }
    ...
    query_import.exec("SELECT ref,desc,pvp,cal,alt_ref,foto FROM articulos");

    db->exec&#40;"BEGIN TRANSACTION;"&#41;;
    
    while(query_import.next())
    {
    ...
    }
    

    @

    The database opens, though it throws this:

    @Error at Line : syntax error near 'test'
    syntax error near 'test'
    Got no result for 'select 'test'' command
    QODBCDriver::checkHasSQLFetchScroll: Warning - Driver doesn't support scrollable result sets, use forward only mode for queries
    database was downloaded, open, and it is ready to be imported @

    The last line is from my qDebug() above.

    Then, when querying it seems like the query has not returned a single line.

    The same query, when run from the isql interface in command line, returns the full table contents (except for the foto field, of course).

    So, has anyone any experience with this kind of thing? The same code worked great in sqlite, but the customer is always right (tm).

    Thank you for any guidance, it will be greatly appreciated. :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.