Building QT with "windeployqt": not connect to database (ODBC)
-
wrote on 4 May 2020, 14:47 last edited by
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!
-
Hi and welcome to devnet,
Did you check that you also deployed the connector's dll and its dependencies along with your application ?
-
wrote on 4 May 2020, 18:10 last edited by
-
Use a tool like Dependency Walker to find the direct dependencies you need to deploy.
-
wrote on 4 May 2020, 20:21 last edited by
-
This is for your application executable, you should check the database plugin.
-
wrote on 4 May 2020, 20:45 last edited by
Mmh so I don't have to open my exe in dependency walker?
Sorry and thank you for your patience... -
wrote on 4 May 2020, 20:56 last edited by
C:\Qt\5.14.2\mingw73_32\plugins\sqldrivers\qsqlodbc.dll
I have to run dependency walker on it, right? -
wrote on 4 May 2020, 21:33 last edited by
Eventually, this is the output:
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.
-
And the ODBC dll ?
-
wrote on 5 May 2020, 19:32 last edited by
ODBC32.dll, no?
-
Yes, did you check the dependencies of that one ?
-
wrote on 5 May 2020, 20:00 last edited by
-
wrote on 5 May 2020, 20:18 last edited by
Unfortunately the problem persists
-
wrote on 5 May 2020, 20:45 last edited by
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?
-
wrote on 5 May 2020, 21:07 last edited by
Yes to both
-
wrote on 5 May 2020, 23:54 last edited by
Ok. Is it same version of Windows 10 on both computers?
-
wrote on 6 May 2020, 01:08 last edited by
Is the ODCB connection created on 2nd computer? Also with mysql connector you need Visual C++2015 distro.
--James
-
wrote on 6 May 2020, 09:04 last edited by
@hskoglund Yes
8/24