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. How to change searching path to MariaDB's C Connector "plugin" folder?
Forum Updated to NodeBB v4.3 + New Features

How to change searching path to MariaDB's C Connector "plugin" folder?

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 891 Views 1 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.
  • Z Offline
    Z Offline
    Zerkg
    wrote on last edited by
    #1

    Hello everyone! (sorry for my (probably) bad English)
    I have an isssue after compilation of qmysql driver (Qt 5.14.2; MinGW 7.3.0, 32-bit; Qt Creator 4.11.2; MariaDB C Connector 3.1.7, Win32). The compilation was succesfully and I've got 3 files: qsqlmysql.dll, qsqlmysql.dll.debug and libqsqlmysql.a. I placed those files into compiler's plugins (sqldrivers) and created a project to test it. After building and launching the following code

    #include <QCoreApplication>
    #include <QDebug>
    #include <QtSql>
    
    int main(int argc, char *argv[])
    {
        QCoreApplication a(argc, argv);
    
        QSqlDatabase db(QSqlDatabase::addDatabase("QMYSQL"));
    
        db.setUserName("root");
        db.setPassword("somepassword");
        db.setDatabaseName("mydb");
    
        db.open() ?  qDebug() << db.tables(): qDebug() << db.lastError();
    
        return a.exec();
    }
    
    

    I got the following debug: "QSqlError("1045", "QMYSQ: Unable to connect", "Plugin caching_sha2_password could not be loaded: Specified module not found. Library path is 'C:/Program Files (x86)/mariadb-connector-c/lib/mariadb/plugin/caching_sha2_password.dll'")

    Yes, there are no "mariadb-connector-c" folder in "C:/Program Files (x86)" directory. I created requested directory and placed there "plugin" folder with all MariaBD's connector plugins. After this all works correctly. But is there are a way to change the searching directory?

    The ways I tried to solve this problem is below. Probably some of those ways looks discouragingly but I tried all ways which I've been ever able to use:

    1. Added LIBS += "path-to-mariadb/plugin/caching_sha2_password.dll". Nothing has changed, the same error;
    2. Placed the MariaDB's "plugin" folder near the builded .exe file. Nothing has changed, the same error;
    3. Created QT_PLUGIN_PATH environment variable and placed the path to the MariaBD's plugin folder. Nothing has changed, the same error;
    4. Used QCoreApplication::addLibraryPath() and QCoreApplication::setLibraryPaths() functions right after creating an QCoreApplication object. No effect, the same error;
    5. Added QMAKE_LIBDIR += "path-to-mariadb/plugin". No effect, the same error;
    6. Copied "qt.conf" file from mingw73_32's "bin" folder into the folder with builded .exe file. Added Plugins=path_to_plugin_folder. After fail, tried to replace "Plugins" to "Libraries". And failed again :) The same error.
    7. Tried to use QLibrary class. The same error.
    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Zerkg said in How to change searching path to MariaDB's C Connector "plugin" folder?:

      caching_sha2_password.dll'

      So where is this shared lib? It must be in the same dir as qsqlmysql.dll otherwise the library can not be loaded.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      Z 1 Reply Last reply
      1
      • Christian EhrlicherC Christian Ehrlicher

        @Zerkg said in How to change searching path to MariaDB's C Connector "plugin" folder?:

        caching_sha2_password.dll'

        So where is this shared lib? It must be in the same dir as qsqlmysql.dll otherwise the library can not be loaded.

        Z Offline
        Z Offline
        Zerkg
        wrote on last edited by
        #3

        @Christian-Ehrlicher Hello!
        The shared lib's path is C:\Qt\MySQL\lib\plugin.
        If I understood you correctly, I must copy caching_sha2_password.dll into compiler's sqldrivers folder, right? I Just tried to copy it but I still have the same error.
        The library caching_sha2_password.dll is loading correctly if place it to debug's specified path (C:/Program Files (x86)/mariadb-connector-c/lib/mariadb/plugin/caching_sha2_password.dll'). I can't understand why Qt looking for this library using specified path and how to change it.

        kshegunovK 1 Reply Last reply
        0
        • Z Zerkg

          @Christian-Ehrlicher Hello!
          The shared lib's path is C:\Qt\MySQL\lib\plugin.
          If I understood you correctly, I must copy caching_sha2_password.dll into compiler's sqldrivers folder, right? I Just tried to copy it but I still have the same error.
          The library caching_sha2_password.dll is loading correctly if place it to debug's specified path (C:/Program Files (x86)/mariadb-connector-c/lib/mariadb/plugin/caching_sha2_password.dll'). I can't understand why Qt looking for this library using specified path and how to change it.

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by kshegunov
          #4

          If I were to guess you have that directory in your PATH variable, you could check that to make sure.

          Read and abide by the Qt Code of Conduct

          Z 1 Reply Last reply
          1
          • kshegunovK kshegunov

            If I were to guess you have that directory in your PATH variable, you could check that to make sure.

            Z Offline
            Z Offline
            Zerkg
            wrote on last edited by Zerkg
            #5

            @kshegunov Hi there and thanks for trying to help me!
            I checked my PATH variable. There are no "C:/Program Files (x86)/mariadb-connector-c/..." directories. I also tried to add paths to MySQL, lib and plugin foldes. My current PATH variable looks like
            84d79229-56e1-416c-a6f7-0d11506f55ca-image.png
            but I still get the same error.

            I forgot to add in my topic that in Qt's SQL Database Drivers there are the following text:

            The configure script cannot detect the necessary libraries and include files if they are not in the standard paths, so it may be necessary to specify these paths using the *_INCDIR=, *_LIBDIR=, or *_PREFIX= command-line options. For example, if your MySQL files are installed in /usr/local/mysql (or in C:/Program Files/MySQL/MySQL Connector C 6.1 on Windows), then pass the following parameter to configure: MYSQL_PREFIX=/usr/local/mysql (or MYSQL_PREFIX="C:/Program Files/MySQL/MySQL Connector C 6.1" for Windows).

            I tried to use it and this is what I got:
            cdfd547b-d5df-4230-9077-2e8869fe3062-image.png

            But still, nothing has changed. Maybe I did something wrong? Or using configure utility is only revelant when you build the driver?

            Christian EhrlicherC 1 Reply Last reply
            0
            • Z Zerkg

              @kshegunov Hi there and thanks for trying to help me!
              I checked my PATH variable. There are no "C:/Program Files (x86)/mariadb-connector-c/..." directories. I also tried to add paths to MySQL, lib and plugin foldes. My current PATH variable looks like
              84d79229-56e1-416c-a6f7-0d11506f55ca-image.png
              but I still get the same error.

              I forgot to add in my topic that in Qt's SQL Database Drivers there are the following text:

              The configure script cannot detect the necessary libraries and include files if they are not in the standard paths, so it may be necessary to specify these paths using the *_INCDIR=, *_LIBDIR=, or *_PREFIX= command-line options. For example, if your MySQL files are installed in /usr/local/mysql (or in C:/Program Files/MySQL/MySQL Connector C 6.1 on Windows), then pass the following parameter to configure: MYSQL_PREFIX=/usr/local/mysql (or MYSQL_PREFIX="C:/Program Files/MySQL/MySQL Connector C 6.1" for Windows).

              I tried to use it and this is what I got:
              cdfd547b-d5df-4230-9077-2e8869fe3062-image.png

              But still, nothing has changed. Maybe I did something wrong? Or using configure utility is only revelant when you build the driver?

              Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Zerkg Please follow the documentation - there is nowhere a statement that you should run configure...

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              Z 1 Reply Last reply
              2
              • Christian EhrlicherC Christian Ehrlicher

                @Zerkg Please follow the documentation - there is nowhere a statement that you should run configure...

                Z Offline
                Z Offline
                Zerkg
                wrote on last edited by
                #7

                @Christian-Ehrlicher said in How to change searching path to MariaDB's C Connector "plugin" folder?:

                Please follow the documentation - there is nowhere a statement that you should run configure...

                I understand but I'm new in Qt and I don't have enough knowledge and experience so I checking every way that can potentially help me to solve the problem... Inconclusively :)
                Probably I made a mistake during qmysql driver's compilation because I used this way to do it (but I used MariaDB C Connector instead of MySQL C Connector). The documentation describe another way but when I tried to follow it I got a "No rule for target sub-mysql. Stop.". Now I trying to build qmysql driver using MySQL C Connector 6.1.11... This is the last of my ideas how to fix this problem.

                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