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. MySql could not load the driver
Forum Updated to NodeBB v4.3 + New Features

MySql could not load the driver

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 4 Posters 1.7k 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.
  • D Offline
    D Offline
    Dan3460
    wrote on 5 Sept 2017, 00:54 last edited by Dan3460 9 May 2017, 01:00
    #1

    I have an application that runs perfectly on my computer, even from a deployment folder that i use to run windeployqt. My problem is that when i take the application to the test compiuter it does not connect to the database. I have modify the function to connect to the database so it show on a text widget the message:
    Does the test computer needs some parts from MySql for this to run? Thanks for the help.

    void DatabaseConnection::on_conenct_clicked()
    {
    db->setHostName(ui->hostname->text());
    db->setDatabaseName("grcr");
    db->setUserName(ui->user->text());
    db->setPassword(ui->passwd->text());
    if(db->open()==true)
    {
    workData->databaseAddress=ui->hostname->text();
    workData->dbUserName=ui->user->text();
    workData->dbUserPswd=ui->passwd->text();
    ui->status->setText("Connected");
    }
    else
    {
    ui->Data->append(db->connectionName());
    ui->Data->append(db->connectOptions());
    ui->Data->append(db->hostName());
    ui->Data->append(db->lastError().text());
    ui->Data->append(QString::number(db->port()));
    db->close();
    ui->status->setText("Not Connected");
    }

    }

    P.S. i did looked for other qtsqlmysql.dll drivers on the test computer but could not find any. Just in case the application was grabbing something from somewhere else.
    1 Reply Last reply
    0
    • Y Offline
      Y Offline
      yellowlemontree2014
      wrote on 5 Sept 2017, 02:14 last edited by
      #2

      I am also facing this situation, though drivers are available, but it is not loading. possible reason could mysql libraries are not linked in the .pro file.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        Dan3460
        wrote on 5 Sept 2017, 14:43 last edited by
        #3

        Well, i tried all kind of different things. I tried to use "dependency walker" to see if i could see what going on to no avail. I downloaded all kind of packages and connectors from MySql website, i even installed mysql workbench and connected to the database. But my application refused to work. Keep telling me that could not load the driver. I'm working on a program that i hope I'm going to sell, when i do i will subscribe to QT customer service but that is too expensive right now, so no finding a solution that can be easily implemented on a customer desktop is not an option. My next step is to compile the program statically, i'm in the process of creating the static compiler for QT. Will let you what happens.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          artwaw
          wrote on 5 Sept 2017, 15:00 last edited by
          #4

          In your program's folder there should be folder /sqldrivers/ in which qsqlmysql.dll file should be placed.

          For more information please re-read.

          Kind Regards,
          Artur

          1 Reply Last reply
          0
          • W Offline
            W Offline
            wojtusm
            wrote on 5 Sept 2017, 15:00 last edited by
            #5

            Maybe you can try to copy libmysql.dll from database installation folder (I don't remember exact place) but for me it helped.

            A 1 Reply Last reply 5 Sept 2017, 15:04
            0
            • W wojtusm
              5 Sept 2017, 15:00

              Maybe you can try to copy libmysql.dll from database installation folder (I don't remember exact place) but for me it helped.

              A Offline
              A Offline
              artwaw
              wrote on 5 Sept 2017, 15:04 last edited by
              #6

              @wojtusm Then you need link to that file while compiling the project. Default MySQL built into Qt uses qsqlmysql.dll as a plugin and nothing more should be required (apart from Qt5Sql.dll in main program's folder).

              For more information please re-read.

              Kind Regards,
              Artur

              1 Reply Last reply
              0
              • D Offline
                D Offline
                Dan3460
                wrote on 5 Sept 2017, 15:53 last edited by
                #7

                Thanks for the advice. I used windeployqt and the tool created all necessary folder and copy all necessary dlls. I did tried, and probably still there, libmysql.dll, i put a copy on the directory where the exe is located. one copy in the sqldrivers directory, but it would not load the driver.
                I have spend more than 12 hours trying to solve this. I really hope that static building will solve the problem or else is more that a month of work wasted as i'm afraid to release a program that will not work on a customer computer.

                A 1 Reply Last reply 5 Sept 2017, 15:58
                0
                • D Dan3460
                  5 Sept 2017, 15:53

                  Thanks for the advice. I used windeployqt and the tool created all necessary folder and copy all necessary dlls. I did tried, and probably still there, libmysql.dll, i put a copy on the directory where the exe is located. one copy in the sqldrivers directory, but it would not load the driver.
                  I have spend more than 12 hours trying to solve this. I really hope that static building will solve the problem or else is more that a month of work wasted as i'm afraid to release a program that will not work on a customer computer.

                  A Offline
                  A Offline
                  artwaw
                  wrote on 5 Sept 2017, 15:58 last edited by
                  #8

                  @Dan3460 said in MySql could not load the driver:

                  I did tried, and probably still there, libmysql.dll, i put a copy on the directory where the exe is located.

                  Can you please make sure that qsqlmysql.dll file is located in %programdir%/sqldrivers/ folder?

                  I assume you compiled the program in release mode. For debug mode file name would be qsqlmysqld.dll.

                  For more information please re-read.

                  Kind Regards,
                  Artur

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    Dan3460
                    wrote on 5 Sept 2017, 17:18 last edited by
                    #9

                    @artwaw Thanks for the answer. Yes i used the windeployqt to create the release folder and yes it was compiled using the release mode. I check the sqldrivers folder and the qsqlmysql.dll is there.

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      Dan3460
                      wrote on 5 Sept 2017, 20:22 last edited by
                      #10

                      My apologies to everyone, it was my stupidity. I was looking at the libmysql.dll, the one that i have been playing with had a time stamp of 8/13/2015, that is the one that i have been using to make the distribution folder. I look on my system and there is a libmysql.dll that is dated 7/13/2017 and it is much smaller. So grabbed that dll and put it on the other system and it works perfectly. My guess is that the older dll is a 64bit, while im compiling everything on 32bit. Again please accept my apologies.

                      1 Reply Last reply
                      0

                      8/10

                      5 Sept 2017, 15:58

                      • Login

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