Recent

Author Topic: zeos library connect mysql error  (Read 930 times)

Packs

  • Sr. Member
  • ****
  • Posts: 368
zeos library connect mysql error
« on: June 26, 2024, 08:30:54 am »
None of the dynamic libraries can be found or is not loadable: libmysqld57.dll, libmysql57.dll, libmysqld56.dll, libmysql56.dll, libmysqld55.dll, libmysql55.dll, libmysqld51.dll, libmysql51.dll, libmysqld50.dll, libmysql50.dll, libmysqld41.dll, libmysql41.dll, libmysql.dll, libmysqld.dll, libmariadb.dll !
Use TZConnection.LibraryLocation if the location is invalid.

I have copied dll on project folder as well as lazarus folder , still getting same error message

af0815

  • Hero Member
  • *****
  • Posts: 1379
Re: zeos library connect mysql error
« Reply #1 on: June 26, 2024, 09:27:24 am »
Only one small question - is the bitness 32bit/64bit correct too?
regards
Andreas

Thaddy

  • Hero Member
  • *****
  • Posts: 16187
  • Censorship about opinions does not belong here.
Re: zeos library connect mysql error
« Reply #2 on: June 26, 2024, 09:33:01 am »
One other question... did you actually install mysql? (or mariadb)
If one of those two are not there, of course it will not work.
« Last Edit: June 26, 2024, 09:35:44 am by Thaddy »
If I smell bad code it usually is bad code and that includes my own code.

Packs

  • Sr. Member
  • ****
  • Posts: 368
Re: zeos library connect mysql error
« Reply #3 on: June 26, 2024, 09:51:51 am »
I have not installed . just copied . it is 64 bit

Thaddy

  • Hero Member
  • *****
  • Posts: 16187
  • Censorship about opinions does not belong here.
Re: zeos library connect mysql error
« Reply #4 on: June 26, 2024, 11:24:52 am »
Certainly on Windows, do not use the current directory but install, depending on bitness in the proper directories: system32 for 64 bit (I KNOW, ask MS, this is not a typo), sysWOW64 for 32 bit dll's.
Code: Text  [Select][+][-]
  1. The reason for this seemingly counter-intuitive setup is due to **backward compatibility** reasons¹². Here's a more detailed explanation:
  2.  
  3. - **System32**: Despite its name, the `System32` directory is reserved for **64-bit** applications on 64-bit Windows⁵. This is because many applications had hard-coded the `System32` path into their system, and when these were ported from 32-bit Windows to 64-bit Windows, they were looking for 64-bit executables and libraries in the `System32` directory².
  4.  
  5. - **SysWOW64**: The `SysWOW64` directory, on the other hand, is intended for **32-bit** applications running on a 64-bit system¹. The term `WOW64` stands for "Windows 32-bit on Windows 64-bit". This directory ensures that 32-bit applications can access the 32-bit DLLs they need³. If a 32-bit program tries to load a 64-bit DLL, it would crash⁴.
  6.  
  7. So, if you have a **64-bit DLL**, it should go into the `System32` folder, and if you have a **32-bit DLL**, it should go into the `SysWOW64` folder³. This setup ensures that applications can find the correct versions of DLLs they need, preventing crashes and improving compatibility⁴.
  8.  
  9. It's worth noting that for an installer, you should not hard-code the path to the system folder. Instead, let Windows take care of it for you based on whether or not your installer is running on the emulation layer¹.
  10.  
  11. Source: Conversation with Copilot, 6/26/2024
  12. (1) Why do 64-bit DLLs go to System32 and 32-bit DLLs to SysWoW64 on 64-bit .... https://stackoverflow.com/questions/949959/why-do-64-bit-dlls-go-to-system32-and-32-bit-dlls-to-syswow64-on-64-bit-windows.
  13. (2) Why do 64-bit DLLs go to System32 and 32-bit DLLs to SysWoW64 on ... - IBM. https://www.ibm.com/support/pages/why-do-64-bit-dlls-go-system32-and-32-bit-dlls-syswow64-64-bit-windows.
  14. (3) File System Redirector - Win32 apps | Microsoft Learn. https://learn.microsoft.com/en-us/windows/win32/winprog64/file-system-redirector.
  15. (4) Why do 64-bit DLLs go to System32 and 32-bit DLLs to SysWoW64 on 64-bit .... https://www.matheusmello.io/posts/windows-why-do-64-bit-dlls-go-to-system32-and-32-bit-dlls-to-syswow64-on-64-bit-windows.
  16. (5) What's the Difference Between the "System32" and "SysWOW64" Folders in .... https://www.howtogeek.com/326509/whats-the-difference-between-the-system32-and-syswow64-folders-in-windows/.
There are many morons on this forum that will advise you the other way around. Above is Microsoft's answer.

For debugging you usually can get away with putting the dll in the program directory and that only can fail if a) the bitness is not correct or b) the dll needs to be registered (a COM dll) or reads registry settings.
I strongly advise to do an install for mysql or mariadb. It is the easy way out.
« Last Edit: June 26, 2024, 11:35:51 am by Thaddy »
If I smell bad code it usually is bad code and that includes my own code.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11944
  • FPC developer.
Re: zeos library connect mysql error
« Reply #5 on: June 26, 2024, 11:55:06 am »
(note that it is not just the named DLL, but also all DLLs that DLL might depend on. For postgresql I need to copy a host of mingw libraries too)

Zvoni

  • Hero Member
  • *****
  • Posts: 2744
Re: zeos library connect mysql error
« Reply #6 on: June 26, 2024, 11:57:38 am »
One other question... did you actually install mysql? (or mariadb)
If one of those two are not there, of course it will not work.
I would amend this Statement, to just/at least INSTALL the CLIENT-Libraries (not the Server-Libs).
The MySQL-DB-Server itself can be running on FreeBSD or whatever other OS in a LAN
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

Thaddy

  • Hero Member
  • *****
  • Posts: 16187
  • Censorship about opinions does not belong here.
Re: zeos library connect mysql error
« Reply #7 on: June 26, 2024, 11:59:12 am »
Correct.
If I smell bad code it usually is bad code and that includes my own code.

 

TinyPortal © 2005-2018