Deploying SQL drivers with an ActiveQt component
-
Hi.
I have an ActiveQt component that makes use of the SQL plugin. The necessary DLLs are expected to be in <application>/sqldrivers.
And this seems to be hardwired (for some unfathomable reasons).Since the ActiveX component is supposed to work in IE, I am obviously not able to deploy the DLLs to that place because the application directory would be the IE directory, which I can not write to (and which also would be a very bad idea).
The only workaround I found for this so far is creating the sqldrivers dir somewhere else (where I'm actually allowed to write to) and set a path with @QCoreApplication::addLibraryPath()@
Unfortunately, this works for me and my testing machines, but not for most of the customers. Not sure what's the problem... does setting that path require admin rights?
Not sure where to go from here. Isn't there a way that would allow me to circumvent the "/sqldrivers" path requirement and just load the DLLs from the same place where my ActiveX DLL is located?
System is Windows (obviously, as I try to run an ActiveX component in IE), IDE is Visual Studio 2010 (although that should not matter for the question) and Qt version is 4.8.4.
-
Hi and welcome to devnet,
The reason is that it's how Qt knows where to look for specific plugins. You can find more information in the "How to Create Qt Plugins" chapter from Qt's documentation.
Does the customer have the MySQL dlls containing folder in it's PATH environment variable ? You can also bundle the client library with your application to ensure everything is available on your client's computer.
Personally, for this use case, I would rebuild Qt with the MySQL support builtin unless you plan to update the MySQL plugin frequently.
Hope it helps
-
Hi SGaist, and thanks for your reply.
[quote author="SGaist" date="1405952285"]The reason is that it's how Qt knows where to look for specific plugins. You can find more information in the "How to Create Qt Plugins" chapter from Qt's documentation.[/quote]Yeah, I've read that... I still don't know why Qt insists on the subdirectory "sqldrivers", though. All other DLLs that are needed are just in the same directory as the ActiveX component - and found there.
[quote author="SGaist" date="1405952285"]Does the customer have the MySQL dlls containing folder in it's PATH environment variable ?[/quote]It doesn't even matter because Qt does not even check there. By default, it checks exactly two locations: The plugins directory of the Qt installation (which the customer does not have) and the application directory... which is IE's directory and hence protected.
More paths can be added via QCoreApplication::addLibraryPath(), but as I mentioned, that does not seem to work reliably.
The standard PATH variable is ignored. I can even copy the suff into the Windows or System32 directory and it's still ignored there.[quote author="SGaist" date="1405952285"]You can also bundle the client library with your application to ensure everything is available on your client's computer.[/quote]That's what I do. The trick is to make Qt find it there.
[quote author="SGaist" date="1405952285"]Personally, for this use case, I would rebuild Qt with the MySQL support builtin unless you plan to update the MySQL plugin frequently.[/quote]I thought about that... but I really hope I can avoid making a custom Qt build...
-
Because it's the place where the sql plugins are expected to be. Each plugin type has it's own folder.
You can also try to play with the qt.conf file.
-
[quote author="SGaist" date="1405978449"]Because it's the place where the sql plugins are expected to be. Each plugin type has it's own folder.[/quote]
I get the concept, it's just that it's a major pain in the posterior in my case. I cannot put the DLLs where Qt wants them and I (apparently) can't make it look elsewhere.[quote author="SGaist" date="1405978449"]You can also try to play with the qt.conf file.[/quote]
Same problem. The qt.conf file is only found when it's in the app directory. -
What is the problem then with having qt.conf in the same folder as the application ?
-
Hi, actually there are more options for telling Qt where your plugin DLLs are, you could try using the same method that is done when you install Qt on your development PC: binary patching Qt5Core.dll with the location of your plugin DLLs.
The one thing you cannot change is that the subdirectory names, has to be called sqldrivers (the filenames of the DLL files themselves doesn't matter).
How to patch Qt5Core.dll, you can read in my "blog post":http://www.tripleboot.org/?p=536 (look for "Binary editing")