Results 1 to 5 of 5

Thread: fast read write mssql information from remot server

  1. #1
    Join Date
    Jun 2011
    Posts
    21
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default fast read write mssql information from remot server

    hi everybody i have a vps server with windows 2003 server and mssql 2008 i connect with port 1433 to mssql in my qt application and read and write information on it but it slow.
    how can i read and write information fast from mssql on vps server?

  2. #2
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: fast read write mssql information from remot server

    Slow compared to what? If you make the identical query through the SQL command line, does it run faster? If you haven't tried this, be sure to try Qt then SQL CLI a few times in succession to reduce various caching effects. It would also be helpful to run the same query on the server itself to narrow down which of the components - database, connection, client - is taking the most time.

    Of course, if the Qt and remote CLI queries take the same amount of time, the problem lies on the DB side of the fence. It may also be that the query itself is inherently slow - returns a large result or involves complex data manipulations to construct.

  3. #3
    Join Date
    Jun 2011
    Posts
    21
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: fast read write mssql information from remot server

    compare with local database.my program work with mssql2008 and need to write large information to database and read.sql command line and qt have same speed i want a solution to increase my speed.can anybody help me

  4. #4
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: fast read write mssql information from remot server

    Since the speed is the same for both direct command line access and Qt access, this isn't a Qt question. You'd be much better off consulting a mssql group and asking them how best to optimize DB access. Note that reading/writing a large amount of information will take a relatively large amount of time, no matter what.

  5. #5
    Join Date
    Jun 2011
    Posts
    21
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: fast read write mssql information from remot server

    i found my problem when i execute a qyery and show the result with qDebug like this it is fast and good speed
    Qt Code:
    1. QSqlQuery query(QSqlDatabase::database("con"));
    2. query.setForwardOnly(true);
    3. query.exec(QString("{CALL AddCourse(%1,%2,%3)}").arg(majoridd).arg(degreeid).arg(termid));
    4. if(!query.isActive())
    5. {
    6. qDebug()<<"EROOORR QUERY";
    7.  
    8. }
    9. else
    10. {
    11. while(query.next())
    12. {
    13. rec = query.record();
    14. qDebug()<<"0:"<<rec.value(0)<<"1:"<<rec.value(1)<<"2:"<<rec.value(2)
    15. <<"3:"<<rec.value(3)<<"4:"<<rec.value(4)<<"5:"<<rec.value(5)
    16. <<"6:"<<rec.value(6)<<"7:"<<rec.value(7);
    17. }
    18. }
    To copy to clipboard, switch view to plain text mode 
    when i use QTableWidget to show information like this it too slow
    Qt Code:
    1. addtableWidget->setItemDelegate(new CheckDelegate);
    2. QTableWidgetItem *item = 0;
    3. //QSqlDatabase::database("con").open();
    4. QSqlQuery query(QSqlDatabase::database("con"));
    5. query.setForwardOnly(true);
    6. query.exec(QString("{CALL AddCourse(%1,%2,%3)}").arg(majoridd).arg(degreeid).arg(termid));
    7. if(!query.isActive())
    8. {
    9. QMessageBox::warning(this, "خطا",
    10. "لطفا با پشتيباني تماس بگيريد");
    11.  
    12. }
    13. else
    14. {
    15. int row = 1;
    16. addtableWidget->setRowCount(row);
    17.  
    18. addlist.clear();
    19.  
    20. int i = 0;
    21. while (query.next())
    22. {
    23. // rec = query.record();
    24. addtableWidget->setItem(i,0,item = new QTableWidgetItem);
    25. item->setFlags(Qt::ItemIsEnabled|Qt::ItemIsUserCheckable);
    26. item->setCheckState( Qt::Unchecked);
    27. rec = query.record();
    28. addlist.insert(i,rec.value(0).toInt());
    29.  
    30. for(int j = 1 ; j<=8 ; j++)
    31. {
    32.  
    33. QTableWidgetItem *item1 = new QTableWidgetItem(rec.value(j).toString());
    34. addtableWidget->setItem(i,j,item1);
    35.  
    36. item1->setFlags(Qt::ItemIsEnabled);
    37.  
    38. }
    39.  
    40. addtableWidget->setRowCount(row+=1);
    41. i++;
    42.  
    43. }
    44.  
    45. addtableWidget->setRowCount(row-=1);
    46.  
    47.  
    48.  
    49.  
    50.  
    51. addtableWidget->resizeColumnsToContents();
    52.  
    53.  
    54.  
    55. }
    56.  
    57. }
    58.  
    59. QSqlDatabase::database("con").close();
    60.  
    61. }
    To copy to clipboard, switch view to plain text mode 

    i guese my problem is QTableWidget can anyone help me?

Similar Threads

  1. Replies: 2
    Last Post: 2nd November 2010, 05:15
  2. Write to Threaded Server
    By Suncell in forum Newbie
    Replies: 17
    Last Post: 9th June 2010, 19:46
  3. How to read Raw Information from CD in MAC?
    By vishal.chauhan in forum General Programming
    Replies: 0
    Last Post: 10th July 2007, 12:26
  4. Replies: 13
    Last Post: 1st June 2006, 14:01
  5. The server cannot write to the client. Why?
    By probine in forum Newbie
    Replies: 12
    Last Post: 24th March 2006, 17:14

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.