DLL build with OCI and MySQL and LabView keeps failing - mysql

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.

Related

Delphi can't connect to MySql, claims libmysql.dll isn't in the path when it is

Before anyone marks this a duplicate, please read to the end, as none of the many similar questions helped.
I've just installed Delphi Community Edition and MySql (recommended download from this link) on Windows 11, but am having trouble connecting Delphi to MySql.
I used MySql Workbench to create a new connection, and created a new database with a table and some sample data.
If I start Delphi and create a new Windows VCL project, then choose Tools -> FireDAC Explorer, then try to expand the connection, I get an error "Cannot load vendor library [libmysql.dll, libmariadb or libmysqld.sll]"
I'm assuming that only libmysql.dll is relevant to me, as I don't use Maria, and don't have the other DLL anywhere on my system. I used sigcheck to check that I indeed have a 64-bit version of the DLL.
I have the same error if I use the Data Explorer in Delphi itself.
I read a lot of questions here about this exact error, but all of the ones I've seen suggest one of two things, neither of which apply here...
Add the DLL's location to the PATH environment variable - I have libmysql.dll in the C:\Program Files\MySQL\MySQL Server 8.0\lib folder, and have added that to my PATH environment variable, but it didn't help. I restarted Delphi, but no joy. I even added a TEdit to my form in Delphi, with the following code...
Edit1.Text := GetEnvironmentVariable('PATH');
This confirmed that I had set the environment variable correctly.
Copy the DLL to the project's bin folder. I tried this as well, and it didn't make any difference. However, as I haven't got as far as trying to connect my code to MySql, I didn't expect this to help. I can't even get Delphi itself to connect.
Anyone any ideas? I know there are a lot of questions about this error, but none of them worked for me.
Thanks
Please check the rest of the error message. Sometimes it specifies the bitness of the DLL you need. It's easy to miss that bit and get the wrong version.
I think MySql comes with a 64-bit DLL, but for some reason I never worked out, Delphi seems to need a 32-bit version. I had to search around and download one from a 3rd-party site, which I don't like, but it did work.

How to reference JSON.NET in SSIS

I need to parse some JSON in an SSIS package. JSON.NET seems popular and well supported. I downloaded the latest version, but...
My development machine already has 97 different copies of Newtonsoft.Json.dll in various places. The target deployment server has over 120. Installing yet another one isn't going to help matters.
I'm using VS 15.9 for development. I read that JSON.NET is already built-in to VS here, but I sure can't find it anywhere in "Add reference". using in C# doesn't seem to bring up anything.
How do I get started?
How will the reference translate when I deploy? Do the .DLL paths need to be the same on dev machine/server, or can it work off some kind of signature?
EDIT:
I've got started, and it works beautifully. I referenced this file:
C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Extensions\Common\Newtonsoft.Json.dll.
It exists on both my target servers. But is this best practice? I have no idea on how best to reference DLLs from SSIS.

Deploy Qt MySql Application

I'm working on Win10 64bit with Qt5.10.1, VS2017, MySql 8.0(64it). Everything is fine in my computer. After I deploy my application on other computers, a error message "Driver not load" pop up.
I have checked many forums including two posts in stackoverflow, [Qt][QMYSQL] Deployed app - Driver not loaded
Deploying qt mysql application
But it doesn't work for me. The following are the dll files in my folder:
qsqlmysql.dll is included in the folder sqldrivers.
All of the platform, software, SDK are 64 bit. can anyone help me? thanks.
Thanks everyone who answer my question. I tried many methods and almost give up. I never used MySQL before and this time I choose the newest MySql 8.0.12. I ignore the procedure and post the solution directly:
Beside libmysql.dll and qsqlmysql.dll, other two *.dll files are also necessary (but no solution I searched refers to them): libeay32.dll and ssleay32.dll, they are located at MySql/bin/. For my computer, they are contained in the system path, while for other computers that do not install MySql, they lack these two. Thus, we need to copy them to the package as well.
For anyone who encounter the same problem, for example using the newest MySql 8.0, you can try this method.

Application does not connect to database when deployed on another computer

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 :)

Delphi 2010, Connect to mySQL and Firebird database without lib dlls

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.