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. [SOLVED] sql driver plugins not loadded

[SOLVED] sql driver plugins not loadded

Scheduled Pinned Locked Moved General and Desktop
12 Posts 2 Posters 3.1k Views
  • 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.
  • CKurduC Offline
    CKurduC Offline
    CKurdu
    wrote on last edited by CKurdu
    #1

    Hi everybody.

    I got following lines and program can not connect mysql database.


    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers:

    I entered the command "ldd libqsqlmysql.so"


    linux-vdso.so.1 (0x00007fff9b5fc000)
    libmysqlclient.so.18 => /usr/lib64/libmysqlclient.so.18 (0x00007f2c436c1000)
    libQt5Sql.so.5 => /home/ckurdu/bin/Qt5.4.1/5.4/gcc_64/lib/libQt5Sql.so.5 (0x00007f2c43480000)
    libQt5Core.so.5 => /home/ckurdu/bin/Qt5.4.1/5.4/gcc_64/lib/libQt5Core.so.5 (0x00007f2c42d44000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f2c42b27000)
    libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007f2c4281e000)
    libm.so.6 => /lib64/libm.so.6 (0x00007f2c4251d000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f2c42306000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f2c41f5e000)
    libz.so.1 => /lib64/libz.so.1 (0x00007f2c41d48000)
    libssl.so.1.0.0 => /lib64/libssl.so.1.0.0 (0x00007f2c41ae1000)
    libcrypto.so.1.0.0 => /lib64/libcrypto.so.1.0.0 (0x00007f2c416bd000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f2c414b9000)
    libicui18n.so.53 => /home/ckurdu/bin/Qt5.4.1/5.4/gcc_64/lib/libicui18n.so.53 (0x00007f2c4106d000)
    libicuuc.so.53 => /home/ckurdu/bin/Qt5.4.1/5.4/gcc_64/lib/libicuuc.so.53 (0x00007f2c40ce1000)
    libgthread-2.0.so.0 => /usr/lib64/libgthread-2.0.so.0 (0x00007f2c40adf000)
    librt.so.1 => /lib64/librt.so.1 (0x00007f2c408d7000)
    libglib-2.0.so.0 => /usr/lib64/libglib-2.0.so.0 (0x00007f2c405c8000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f2c43e78000)
    libicudata.so.53 => /home/ckurdu/bin/Qt5.4.1/5.4/gcc_64/lib/libicudata.so.53 (0x00007f2c3ef40000)
    libpcre.so.1 => /usr/lib64/libpcre.so.1 (0x00007f2c3ecd5000)

    So there is no unfounded library file.

    You reap what you sow it

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Did you check the error message returned by QSqlDatabase ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • CKurduC Offline
        CKurduC Offline
        CKurdu
        wrote on last edited by
        #3

        this->dbo->setHostName(hostname);
        this->dbo->setDatabaseName(databasename);
        this->dbo->setUserName(username);
        this->dbo->setPassword(password);
        if (!this->dbo->open()) {
        qDebug()<<"Database Error"<<this->dbo->lastError().text()<<endl;
        return false;
        }

        I got "Driver not loaded Driver not loaded" error.
        Why is it twice?

        You reap what you sow it

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Looks like you are doing something unusual.

          QSqlDatabase's initialization should rather look like:

          QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL")
          db.setHostname(hostname);
          etc.
          

          How are you doing it ?

          Another thing that is puzzling is that your plugin list is empty.
          What does
          qDebug() << QSqlDatabase::drivers();
          return ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • CKurduC Offline
            CKurduC Offline
            CKurdu
            wrote on last edited by CKurdu
            #5

            This is the full code of creation of database connection.


            bool Factory::createConnection()
            {
            qDebug()<<"Connection has been creating"<<endl;
            this->dbo = new QSqlDatabase(QSqlDatabase::addDatabase("QMYSQL"));
            this->setting->beginGroup("database");
            QString hostname = this->setting->value("host").toString();
            QString username = this->setting->value("user").toString();
            QString password = this->setting->value("password").toString();
            QString databasename = this->setting->value("databasename").toString();

                qDebug()<<"password : "<<password<<endl;
                this->dbo->setHostName(hostname);
                this->dbo->setDatabaseName(databasename);
                this->dbo->setUserName(username);
                this->dbo->setPassword(password);
                if (!this->dbo->open()) {
                   qDebug() <<"Available Drivers : " << QSqlDatabase::drivers()<<endl;
                    qDebug()<<"Database Error : "<<this->dbo->lastError().text()<<endl;
                    return false;
                }
                qDebug()<<"Database connected"<<endl;
                return true;
            

            }


            Output of this program.

            Plugins location "/home/ckurdu/bin/Qt_5_4.1/5.4/gcc_64/plugins"

            Plugins Prefixpath "/home/ckurdu/bin/Qt_5_4.1/5.4/gcc_64"

            Factory loaded

            Connection has been creating

            QSqlDatabase: QMYSQL driver not loaded
            QSqlDatabase: available drivers:
            password : "wqerqwefas"

            **Available Drivers : () **
            **Database Error : "Driver not loaded Driver not loaded" **

            Module not loaded

            "The shared library was not found."

            Module not loaded

            "The shared library was not found."

            You reap what you sow it

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Did you build Qt yourself ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • CKurduC Offline
                CKurduC Offline
                CKurdu
                wrote on last edited by
                #7

                No
                I only built myself libqsqlmysql.so. Also I installed qt 5.4.1 3 hours ago.
                My os is Opensuse 13.2 64 bit.

                You reap what you sow it

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Might sound silly, but did you also installed it ? I'm still puzzled by that empty list of drivers...

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • CKurduC Offline
                    CKurduC Offline
                    CKurdu
                    wrote on last edited by CKurdu
                    #9

                    I am so sorry. I found the problem. I made a stupid error. in my qt.conf file I wrote wrong path for prefix. So program couldn't have found the plugin location.

                    Thank you very much.

                    You reap what you sow it

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      Are you doing a deployment ?

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • CKurduC Offline
                        CKurduC Offline
                        CKurdu
                        wrote on last edited by
                        #11

                        Actually I have a main program that has already deployed for my desktop computer and I am programming a module for it. I copied the program from my desktop to my laptop than I continued to develop my module where I left off. But I forget to change "my.conf" file for the main program.

                        Thank you.

                        You reap what you sow it

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          Wouldn't it be simpler also for debugging to build both ?

                          In any case, since you have it working now, please mark the thread as solved so other forum users may know a solution has been found :)

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          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