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. Qt & SQLite deploy problems.

Qt & SQLite deploy problems.

Scheduled Pinned Locked Moved General and Desktop
15 Posts 7 Posters 16.6k 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.
  • Z Offline
    Z Offline
    zither
    wrote on last edited by
    #4

    In your application folder, make a directory namely "sqldrivers" & copy qsqlite.dll file to there. E.g.,
    Applications Folder
    ->YourApp.exe
    -> sqldrivers\qsqlite.dll

    It's work. No need to add library path unless you want to place that file @ specific place

    1 Reply Last reply
    0
    • S Offline
      S Offline
      seg_fault
      wrote on last edited by
      #5

      [quote author="zither" date="1311954455"]In your application folder, make a directory namely "sqldrivers" & copy qsqlite.dll file to there. E.g.,
      Applications Folder
      ->YourApp.exe
      -> sqldrivers\qsqlite.dll

      It's work. No need to add library path unless you want to place that file @ specific place
      [/quote]

      Hi zither,

      I have already done as you suggested but the database still fails to load. Additionally I am also experiencing a seg fault at the QMessageBox in the code below; are these two errors maybe related, can you see anything I am missing?

      @
      db = QSqlDatabase::addDatabase("QSQLITE");
      db.setDatabaseName(dbName);
      if(!db.open()){
      qDebug() << "Couldn't db.open()";
      QMessageBox::critical(0, qApp->tr("Cannot open database"),db.lastError().text(), QMessageBox::Cancel);
      }
      @

      I can also confirm that the error is "Driver not loaded Driver not loaded."

      [EDIT: fixed code formatting, please use @-tags, not “code”, Volker]

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sfilippidis
        wrote on last edited by
        #6

        Well, I would make an guess here: ;-)

        Investigate the possibility that the “Driver not loaded Driver not loaded.” and the SEG FAULT are two different problems.

        https://www.filippidis.name/

        1 Reply Last reply
        0
        • S Offline
          S Offline
          seg_fault
          wrote on last edited by
          #7

          [quote author="Stavros" date="1312021044"]Well, I would make an guess here: ;-)

          Investigate the possibility that the “Driver not loaded Driver not loaded.” and the SEG FAULT are two different problems. [/quote]

          Thanks Stavros, my question obviously wasn't clear.
          Could the failure to load the db driver and the subsequent failure of db.open() cause any future calls, such as db.lastError().text(), to result in an access violation?
          I realise this is a separate issue though, which I'll handle once I get the library loaded, I was just wondering at the time of writing the post.

          1 Reply Last reply
          0
          • Z Offline
            Z Offline
            zither
            wrote on last edited by
            #8

            To differentiate library can't available or file error, use this code

            @db = QSqlDatabase::addDatabase("QSQLITE");
            if (!db.isDriverAvailable("QSQLITE"))
            QMessageBox::warning(this,"Error",db.lastError().text());@

            If no library in path, error will prompt "Driver not loaded ...".
            Otherwise, that may be file error..

            1 Reply Last reply
            0
            • S Offline
              S Offline
              seg_fault
              wrote on last edited by
              #9

              Hi Zither,

              I simply get "Driver not loaded." But I know this is the case since if I restore the SDK path it works just fine.
              It simply won't run qsqlite4.dll out of ./plugins/sqldrivers/ nor ./sqldrivers/

              Thanks.

              1 Reply Last reply
              0
              • A Offline
                A Offline
                alexisdm
                wrote on last edited by
                #10

                Are you sure you copied the correct qsqlite4.dll ?
                There is an incompatible one in QtSDK/QtCreator/bin/sqldrivers and if you are compiling in debug mode, you should probably copy qsqlited4.dll instead of qsqlite4.dll in ./sqldrivers directory.

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  sigrid
                  wrote on last edited by
                  #11

                  To get information from Qt about the loading of the plugin, you can use the "QT_DEBUG_PLUGINS ":http://doc.qt.nokia.com/latest/deployment-plugins.html environment variable. This might help you to find the cause of the problem. Set this variable to a non-zero value in the environment from which your application is launched.

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    seg_fault
                    wrote on last edited by
                    #12

                    Hi Guys,

                    I am still struggling with this problem. Does anyone have any other suggestions?

                    I have tried multiple systems and different installs of Mingw & Qt with the same result every time.

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      derrek.telops
                      wrote on last edited by
                      #13

                      QT 5.3.1
                      Using qsqlite

                      I had this same problem and solved with a shotgun approach. I knew it was missing the dll, just didn't know where so I put the dll everywhere, presto it works. Then with the application still running I attempted to delete each of the eight qsqlite.dll files. I could delete 7, one of them was locked. Excellent.

                      So it seems that with a deployed application you want to create a "sqldrivers" folder beside the platforms folder and place your sql dll in there. Here is my layout:

                      My.exe
                      Qt5Core.dll
                      Qt5Sql.dll
                      +\platforms ( qwindows.dll, qoffscreen.dll, qminimal.dll )
                      +\sqldrivers ( qsqlite.dll )

                      Cheers All,
                      Derrek

                      1 Reply Last reply
                      0
                      • JKSHJ Offline
                        JKSHJ Offline
                        JKSH
                        Moderators
                        wrote on last edited by
                        #14

                        Thanks for sharing your solution, Derrek. For future reference, the procedure is documented at http://qt-project.org/wiki/Deploy_an_Application_on_Windows (diagram below).

                        Note that your program will only use qwindows.dll, so you don't need qofscreen.dll and qminimal.dll.

                        !http://i.imgur.com/S582DlV.png(Deployment)!

                        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          seg_fault
                          wrote on last edited by
                          #15

                          For the record;

                          This problem was fixed up by eventually grabbing a later release (think I built from source too).

                          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