Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Building QT with "windeployqt": not connect to database (ODBC)

Building QT with "windeployqt": not connect to database (ODBC)

Scheduled Pinned Locked Moved Solved Installation and Deployment
databaseodbcwindeployqtbuild
24 Posts 4 Posters 4.4k 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.
  • A Offline
    A Offline
    AndreaCT
    wrote on 4 May 2020, 14:47 last edited by
    #1

    Hello, and sorry for my not perfect English.

    I developed a simple UI application with QT, connected to a local database (using XAMPP). I downloaded the ODBC connector (https://dev.mysql.com/downloads/connector/odbc) and configured the connection to the database through ODBC Data Sources. In the main I connect to the database and everything works correctly.

    Then I generated the executable of my project and related dependencies using the windeployqt command from terminal. I put all in the same folder and the executable works perfectly.

    Then I moved everything (exe + dependencies) to another PC (with the same database locally and xampp running), but here the connection to the database fails.

    How can I solve it? Thanks!

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 4 May 2020, 15:52 last edited by
      #2

      Hi and welcome to devnet,

      Did you check that you also deployed the connector's dll and its dependencies along with your application ?

      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
      • A Offline
        A Offline
        AndreaCT
        wrote on 4 May 2020, 18:10 last edited by
        #3

        That's all! Into sqldrivers there is qsqlodbc.dll

        aed36cf9-821e-46a5-ad84-9ba6f62bf267-image.png

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 4 May 2020, 18:12 last edited by
          #4

          Use a tool like Dependency Walker to find the direct dependencies you need to deploy.

          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
          • A Offline
            A Offline
            AndreaCT
            wrote on 4 May 2020, 20:21 last edited by
            #5

            Mmh this is the output:

            859ec731-b1c2-4409-b553-1fda4451e4b1-image.png

            How can recognize and integrate the direct dependencies?

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 4 May 2020, 20:28 last edited by
              #6

              This is for your application executable, you should check the database plugin.

              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
              • A Offline
                A Offline
                AndreaCT
                wrote on 4 May 2020, 20:45 last edited by
                #7

                Mmh so I don't have to open my exe in dependency walker?
                Sorry and thank you for your patience...

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  AndreaCT
                  wrote on 4 May 2020, 20:56 last edited by
                  #8

                  C:\Qt\5.14.2\mingw73_32\plugins\sqldrivers\qsqlodbc.dll
                  I have to run dependency walker on it, right?

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    AndreaCT
                    wrote on 4 May 2020, 21:33 last edited by
                    #9

                    Eventually, this is the output:

                    3d776aa1-95bd-4e70-a895-b5eb28b92d2b-image.png

                    These are already present:

                    • LIBGCC_S_DW2-1.DLL
                    • LIBSTDC++-6.DLL
                    • QT5CORE.DLL
                    • QT5SQL.DLL

                    I downloaded the other 3 [https://www.dll-files.com/search.dll.html], and added these in the same folder.

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 5 May 2020, 19:14 last edited by
                      #10

                      And the ODBC dll ?

                      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
                      • A Offline
                        A Offline
                        AndreaCT
                        wrote on 5 May 2020, 19:32 last edited by
                        #11

                        ODBC32.dll, no?

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on 5 May 2020, 19:50 last edited by
                          #12

                          Yes, did you check the dependencies of that one ?

                          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
                          • A Offline
                            A Offline
                            AndreaCT
                            wrote on 5 May 2020, 20:00 last edited by
                            #13

                            53b13833-e676-4a7d-ba28-64abf8e93832-image.png

                            Download and put inside all the missing dll?

                            1 Reply Last reply
                            0
                            • A Offline
                              A Offline
                              AndreaCT
                              wrote on 5 May 2020, 20:18 last edited by
                              #14

                              Unfortunately the problem persists

                              1 Reply Last reply
                              0
                              • H Offline
                                H Offline
                                hskoglund
                                wrote on 5 May 2020, 20:45 last edited by
                                #15

                                Hi, just guessing, are you using 127.0.0.1 (or localhost) to connect to the database also on the new PC? Also, have you checked that you can reach the database with MySQL workbench?

                                1 Reply Last reply
                                0
                                • A Offline
                                  A Offline
                                  AndreaCT
                                  wrote on 5 May 2020, 21:07 last edited by
                                  #16

                                  Yes to both

                                  1 Reply Last reply
                                  0
                                  • H Offline
                                    H Offline
                                    hskoglund
                                    wrote on 5 May 2020, 23:54 last edited by
                                    #17

                                    Ok. Is it same version of Windows 10 on both computers?

                                    A 1 Reply Last reply 6 May 2020, 09:04
                                    0
                                    • J Offline
                                      J Offline
                                      JSher
                                      wrote on 6 May 2020, 01:08 last edited by
                                      #18

                                      Is the ODCB connection created on 2nd computer? Also with mysql connector you need Visual C++2015 distro.

                                      --James

                                      1 Reply Last reply
                                      0
                                      • H hskoglund
                                        5 May 2020, 23:54

                                        Ok. Is it same version of Windows 10 on both computers?

                                        A Offline
                                        A Offline
                                        AndreaCT
                                        wrote on 6 May 2020, 09:04 last edited by
                                        #19

                                        @hskoglund Yes

                                        1 Reply Last reply
                                        0
                                        • A Offline
                                          A Offline
                                          AndreaCT
                                          wrote on 6 May 2020, 09:15 last edited by
                                          #20

                                          @JSher No, I just tried to print the error on a label with db.lastError() and the output is: "[Microsoft][Driver Manager ODBC] Nome origine dati non trovato e driver predefinito non specificato. QODBC3: Unable to connect"

                                          1 Reply Last reply
                                          0

                                          3/24

                                          4 May 2020, 18:10

                                          21 unread
                                          • Login

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