I am writing a portable application that connects to both a firebird database and a mysql database. I am writing the application in Delphi 2010, and using dbExpress components to connect to both databases. SQLconnection component uses dbxmys.dll and libmysql.dll for the mysql database, and dbxfb.dll and fbclient.dll for the firebird database.
On my development computer I had to move the dll files into /windows/system/. I think this is because of the system paths, in order to find the correct files and connect. I tried this on another client machine, and the software could not connect because the dll files were not found. Because this is a portable application I do not want to include a sub directory of the application directory to include the dll files, however I do not think the a client machine can run the applicaiton without having mySQL and Firebird installed and the pathing set correctly.
Is there a better way to do this? I have concidered making a sub directory and forcing my application to look there, (since firebird and mySQL can be installed anywhere) if they were included I would know for sure were they were at on any computer my app is launched from. But I don't really want to take this approach.
What are my options as far as direct db connection, or solving the dll requirement problem, I am not an experienced software developer. Thanks in advance.
Update:
The DLLs are now in the same directory with the exe, and the application launches fine. I Still do not want to use any dlls. I have found a few components that do not require dlls, but they also require payment, finding another free option would be ideal.
What you can do is to store the .dll within the main .exe as zipped resources, then expand them in a local folder (local "Application data" for instance), and execute the library from there. Therefore, you do not need to put files in the system path (probably with administrator rights), nor change the path itself.
As a result, you do not need to copy the .dll with the .exe, and if the .dll are already available, your application will use them. The .exe folder won't be "polluted" by the library files, and your software could be still self-installing: if you copy the .exe in another computer, you still have the .dll within it, ready to be installed in an hidden local folder.
This is for instance how our SynProject tool use Hunspell libraries for spell checking. See this SO answer.
Related
We are seeing an issue with Delphi/FireDAC applications not seeing the required libmysql.dll despite the dll being in the same folder as the Executable.
The issue is only being seen on a single user who has had their machine reimaged. It is happening for all Delphi/FireDAC executables.
Our software is distributed with each Executable in it's own folder with a libmysql.dll and FDConnections.ini defining the required database connections for each application.
We don't distrbute FDDrivers.ini to users as discussed in this question, however on the user in question adding an FDDrivers.ini with a VendorLib set to the explicit location of the driver dll the error message changes but still cannot see the required file.
It feels as if the System (Windows 10) or possibly the AntiVirus are "hiding" the dll from the Application.
Has anyone seen similar?
NOTE: I've been successfully building these DLLs that can be executed by LabView for over 15 years now (and Excel too, recently). As a matter of fact, LabView can view all the entry points into the DLL, it just can't execute them.
Having taken out MySQL and Oracle/OCI functionality, LabView can now execute my code properly. It appears the culprits are in, libmysql.lib and oci.lib
I guess the easy way to replace the MySQL library is with MariaDB. Any suggestions for OCI?
Turns out the linking and build were fine. With the instantclient installation Oracle doesn't make any changes to the registry so that the OS can find OCI.DLL. When I used LabView to load OCI.DLL from the instantclient directory, those functions loaded fine, so I then placed OCI.DLL in the same directory as my LabView source and everything worked as it should.
The MySQL issue was resolved with linking to mysqlclient.lib instead of libmysql.lib
I think it's important to note that Oracle provided no help or support.
I built a qt application that connects and queries a database using mysql . it works perfectly fine on my development computer (the computer with Qt Creator on it). but when I deploy it using windeployqt.exe and run it on another computer it doesn't connect to the database for some odd reason.
Note that I do have a working database (mysql as well) on the other computer (the one that fails to connect to the database)
I'm not sure what to do, I tried using addLibraryPaths but it didn't work (I'm not even sure if I did it correctly).
I'm using :
mysql server 5.5.36
workbench 6.0
Qt Creator 5.4.0
I also tried looking into statically building my application but I failed to understand the procedures in doing so.
I would greatly appreciate it if any of you Qt gods could help with this.
i finally found the problem and solved it.
problem: for some reason the target computer wasnt recognizing or reading libmysql.dll in C:\Windows ,and thanks to #Marco i used db.LastError and got my application to display the error , it was "Driver not Loaded Driver not Loaded" which meant that there was something wrong with libmysql.dll (note i copied this dll from MySql folder installed on the target machine )
Solution : i had to copy libmysql.dll from my development machine and place it in C:\Windows on the target machine (i noticed that libmysql.dll on my target machine was smaller in size than the one i used on my development machine)
for some reason the program only operates when the libmysql.dll from the development machine is present in C:\Windows in the target machine
this solution should fix any "Driver not loaded" or "QMySQL driver not loaded "(etc) errors . thanks everyone for trying to help , thanks again #Macro
I assume you built your application in release mode instead of debug mode.
If you have libmysql.dll and qsqlmysql.dll alongside your executable. Create a directory/folder and name it sqldrivers. Place qsqlmysql.dll in the directory you created and deploy it alongside your executable.
PS: I didn't see nnb's comment earlier. I think he's saying the same thing as my answer
From the comment we have cleared that there is a problem loading the driver, I am confident that you have the put qsqlmysql.dll in the correct place, as you have used the deploying utility, so I suspect that the problem is qsqlmysql.dll needs another dll that cannot be found in the system path.
I suggest that you run this tool:
http://www.dependencywalker.com/ on the qsqlmysql.dll
That will help you finding out what is missing, when you find that out, you will probably have to modify the system path or to install a dll that is missing.
I know this thread is old, but I've been having the same issue, and the solution was very easy (once you know).
The problem is that when you execute your application inside Qt, it will find the needed dll to load the drivers (libmysql.dll) if you located it in the correct Qt folder (Qt/path_to_compiler/bin), in my case: C:\Qt\5.9.1\msvc2017_64\bin. But when you try to execute the deployed executable, it is not able to find it. You will notice that the problem is solved if you paste the dll in C:\Windows, as #Nelioussness said. But that's not the solution, as it won't work in a different computer.
Just go to MySQL installation folder and look for the file libmysql.dll if you didn't do it before. In my case, it was located in C:\Program Files\MySQL\MySQL Server 5.7\lib. Once you find it, copy it to your release folder, exactly at the same level as the executable. It didn't work for me when I put it inside 'sqldriver' folder and everything was solved by just putting it outside, next to the .exe
Hope this helps :)
What is the best practice for creating an installer for a winform application.
The application is supposed to install the following without connecting to internet.
.Net Framework 3.5sp1
MySQL Server
My SQL Connector
Restore Mysql db
Update Config file with the MySQL uname/pwd.
I have all the msi files for installing the above mentioned items. But am wondering about the best practice to create the installer.
Thanks in advance,
Hi I came up with a similar situation. Firstly you should have .NET framework offline installer which can be downloaded from http://www.microsoft.com/downloads/en/details.aspx?FamilyID=992cffcb-f8ce-41d9-8bd6-31f3e216285c. I assume you are using visual studio installer. There are couple of choices but I prefer to copy the offline .NET installer to the setup projects output directory and from requirements on target machine tab I set the install URL property of .NET framework the exact name of offline setup file. As described in the figure.
So the installer does not try to connect to a remote computer to download .NET framework and install it however I think it is more appropriate that it connects to a Microsoft server and installs it. Anyways the next step is to configure the MySQL server. MySQL is really generous for me since they support a fully documented noinstall files. You can find the document here: http://dev.mysql.com/doc/refman/5.5/en/windows-install-archive.html
Using a noinstall zip archive you can copy the dbengine core files to any folder on the clint machine. And change the configuration parameters of MySQL. You can name the MySQL service anything you want. Start the the service and create tables. You can do all of this stuff from custom actions tab of the setup project choosing the appropriate script files or you can write code for it. The beautiful thing is that your customer does not need to know that he/she is installing a database engine on the target machine. I hope this helps. Thanks.
I have a .NET application which uses an accdb file (MS Access 2007 format) as its database. To install this app on another machine I need to install the Access engine on that machine. Microsoft has this file: AccessDatabaseEngine.exe which includes the engine, but when extracted during installation, runs another .msi installer.
As you can guess, since this msi is run during the installation of another msi (my app's installer) the Access engine setup fails with error 1500: "Another installation is in progress. Finish that one before continuing this one..."
I found the Runtime for Access 2007 as well, and it does install the engine, but the Runtime package is again an msi installer which means I'm still having the same problem.
Any ideas to include the engine in my app's installer?
You probably want to have a look at this article: Adding Programs to Access 2007 Deployment Packages
The Access Developer Extensions offer a basic but functional installer that can take care of the general deployment scenarios.
The best think would be to build your own msi pack including needed access files. You could use a product like VERITAS Wininstall. You have this "Discover" method that allows you to build a fully operationial .msi file by (1) taking 2 snapshots of your system (one before the installation, one after) then (2) creating the .msi file corresponding to the installation process.
Anyway, I'd advise you to have multiple packs, one for Access, that can be installed with a "for all users" option when the computer joins your company's domain, one for your app. By doing so you will be able to distribute new versions of your app without redistributing Access, which takes a few mega of space as well as a few minutes of user's most precious time).
Sio if Microsoft already delivers an Access Runtime msi package, just keep it 'as is' and distribute it automatically on your network when a new machine joins the domain.
I wouldn't recommend WinInstall, we have it in my office and we have to keep calling them in to package stuff for us as it's so finiky to use. Some things they haven't been able to package at all. WISE Studio is better or a free alternative is AppDeploy whihc I have heard great things about.
I found this software called "Bootstrapper Manifest Generator" or BMG. It helps create a prerequisite package using an MSI or EXE installer file, and adds it to VS2008 Prerequisites dialog box in Setup and Deployment projects. Although it's not that user friendly, it does the job. It's on MSDN: code.msdn.microsoft.com/bmg
Thought it's good to save others from going through all the trouble.