Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Slow database connection
Forum Updated to NodeBB v4.3 + New Features

Slow database connection

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 1.4k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    great88
    wrote on last edited by
    #1

    I connect to my database using following code :
    @
    db = QSqlDatabase::addDatabase("QMYSQL");
    db.setHostName("server-name");
    db.setPort(3306);
    db.setDatabaseName("database_name");
    db.setUserName("root");
    db.setPassword("password");
    if (!db.open())
    {

    }
    @

    This seems to work fine when my application is running on local machine
    where the MySql database is running . But when I run the application
    remotely , there is some considerable delay connecting
    to the database . It seems like either the drivers are taking too long to load
    or MySql handles remote connections too slowly .

    Is this a driver issue or is it MySql ? Anybody have a similar problem ?

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      Just place the time information between all the instruction & measure the same. One suspect I have is DNS resolution for your server name. Try giving the IP address directly. See how it goes.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • N Offline
        N Offline
        NickF15
        wrote on last edited by
        #3

        Any solution found for your problem? if yes can you share it please...

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved