Results 1 to 6 of 6

Thread: very slow access to +100 Mb .mdb file with ODBC driver

  1. #1
    Join Date
    Aug 2013
    Posts
    13
    Thanks
    2
    Qt products
    Qt5

    Default very slow access to +100 Mb .mdb file with ODBC driver

    Hi to all,

    do you have a clue why counting 190 tables in mdb lasts for over a minute and half,
    and time to closing connection lasts almost 2 minutes from reading the tables?

    mdb file which is read is 120 megs!

    this is part of code,
    .cpp and .h file attached...
    Qt Code:
    1. QStringList list = db.tables(QSql::Tables);
    2. //qDebug() << "Views list\n " << list.join(",").toLocal8Bit().data() << "\n";
    3. qDebug() << list.count();
    4. if(db.tables().isEmpty()){
    5. qDebug() << "list empty ";
    6. }
    7. else {
    8. qDebug() << "list not empty";
    9. }
    To copy to clipboard, switch view to plain text mode 

    .h file
    Qt Code:
    1. #ifndef WIDGET_H
    2. #define WIDGET_H
    3. #include <QWidget>
    4. #include <QtSql/QSqlDatabase>
    5. #include <QSqlError>
    6. #include <QSqlQuery>
    7. #include <QStringList>
    8.  
    9.  
    10. namespace Ui {
    11. class Widget;
    12. }
    13. class Widget : public QWidget
    14. {
    15. Q_OBJECT
    16.  
    17. public:
    18. explicit Widget(QWidget *parent = 0);
    19. ~Widget();
    20.  
    21. public:
    22. QString vrijeme;
    23. QString vrijemeKraj;
    24. QSqlQuery sqlTrazi;
    25.  
    26. bool conOpen(){
    27.  
    28. db=QSqlDatabase::addDatabase("QODBC");
    29. db.setDatabaseName("DRIVER={Microsoft Access Driver (*.mdb)};FIL={MS Access};DBQ=D:/Instalacija/syn/Storage.mdb");
    30.  
    31. if(!db.open())
    32. {
    33. //qDebug() << "Database Error" << db.lastError(); //<< db.lastError().text();
    34. return false;
    35. }
    36. else
    37. {
    38. return true;
    39. }
    40. }
    41. void closeConnection(){
    42. db.close();
    43. }
    44. private:
    45. Ui::Widget *ui;
    46. //QSqlDatabase db;
    47. };
    48.  
    49. #endif // WIDGET_H
    To copy to clipboard, switch view to plain text mode 
    .cpp file
    Qt Code:
    1. #include "widget.h"
    2. #include "ui_widget.h"
    3. #include <QDebug>
    4. #include <QTime>
    5.  
    6. Widget::Widget(QWidget *parent) :
    7. QWidget(parent),
    8. ui(new Ui::Widget)
    9. {
    10. ui->setupUi(this);
    11. qDebug() << QSqlDatabase::drivers();
    12. QVector<QString> lista; //this is not used at the moment
    13.  
    14.  
    15. if(!conOpen()){
    16. qDebug() << "konekcija nije uspjela " << "\n"; //not connected
    17. }
    18. else {
    19. qDebug() << "konekcija je uspješna"; //connected...
    20. }
    21.  
    22. vrijeme = QTime::currentTime().toString("hh:mm:ss:zzz");
    23. qDebug() << vrijeme << "\n";
    24.  
    25. QStringList list = db.tables(QSql::Tables);
    26. qDebug() << list.count();
    27. if(db.tables().isEmpty()){
    28. qDebug() << "list empty - lista je prazna";
    29. }
    30. else {
    31. qDebug() << "list not empty - Lista nije prazna?";
    32. }
    33. Widget::closeConnection();
    34. vrijemeKraj = QTime::currentTime().toString("hh:mm:ss:zzz");
    35. qDebug() << vrijemeKraj << "\n";
    36. qDebug() << "connection closed-konekcija zatvorena ";
    37.  
    38. }
    39.  
    40. Widget::~Widget()
    41. {
    42. delete ui;
    43. }
    To copy to clipboard, switch view to plain text mode 
    Attached Files Attached Files
    Last edited by GoranSimunic; 8th March 2016 at 18:53.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,328
    Thanks
    317
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: very slow access to +100 Mb .mdb file with ODBC driver

    I can't answer your question, but PLEASE use CODE tags when you post source code.

    There are two ways to do this:

    1 - Manually insert the tags before and after your code. Put [ CODE] before the source code, and [ /CODE] after it. (Remove the space I have placed after the "[" - it's there to prevent the forum from converting the text into an actual CODE tag).

    2 - Click "Go advanced" when you start to post. Click the "#" icon, which will insert the tags. Paste your code between them.

    As it stands now, the code you post is unreadable and it makes it extremely hard to see what is wrong.

  3. The following user says thank you to d_stranz for this useful post:

    GoranSimunic (8th March 2016)

  4. #3
    Join Date
    Aug 2013
    Posts
    13
    Thanks
    2
    Qt products
    Qt5

    Default Re: very slow access to +100 Mb .mdb file with ODBC driver

    Hi,
    thanks for editing this instead of me. I will be careful in further posts.

  5. #4
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: very slow access to +100 Mb .mdb file with ODBC driver

    Is your D drive a local drive or mapped network drive?
    I write the best type of code possible, code that I want to write, not code that someone tells me to write!

  6. #5
    Join Date
    Aug 2013
    Posts
    13
    Thanks
    2
    Qt products
    Qt5

    Default Re: very slow access to +100 Mb .mdb file with ODBC driver

    Yes it is my local drive, (I use for tesing), but also yes, I would like to do some SELECT (and update) statement to that same table on mapped network drive on Windows small bussines server 2011.
    As user I have access to to read and write to that mapped disk (e.g. X:/)

  7. #6
    Join Date
    Aug 2013
    Posts
    13
    Thanks
    2
    Qt products
    Qt5

    Default Re: very slow access to +100 Mb .mdb file with ODBC driver

    For slow reading of 120 Mb mdb file I've found that this problem seems to be slow PC/and disk

    1. HP 650 (I3 8Gb ram 5400HD) Qt 5.5.1 32 bit MinGW - over 2 minutes connect, query close connection (list 200 tables),
    2. vs Dell 5520 I5 8Gb ram 5400 HD, Qt 5.3.0 32 bit MinGW, 66 miliseconds connect, query, close connection(list 200 tables)

    I don't know how such difference is possible.
    Attached Files Attached Files
    Last edited by GoranSimunic; 17th March 2016 at 00:06.

Similar Threads

  1. Deploying QT App using ODBC driver
    By AlphaWolfXV in forum Installation and Deployment
    Replies: 7
    Last Post: 5th December 2014, 13:19
  2. Replies: 0
    Last Post: 3rd November 2014, 16:07
  3. Building odbc driver in Qt 5.0.1
    By keti in forum Newbie
    Replies: 1
    Last Post: 25th March 2013, 15:49
  4. Slow ODBC driver or programming error?
    By TorAn in forum Qt Programming
    Replies: 9
    Last Post: 13th November 2011, 22:31
  5. source code for odbc driver or MySql driver in arm-embedded-linux
    By sattu in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 24th January 2011, 10:11

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.