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
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] sql driver plugins not loadded

Scheduled Pinned Locked Moved General and Desktop
12 Posts 2 Posters 3.1k 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.
  • 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