Recent

Author Topic: MySQL client connections (they don't see libmysql.dll)  (Read 2563 times)

Vittorio

  • New Member
  • *
  • Posts: 32
MySQL client connections (they don't see libmysql.dll)
« on: July 28, 2020, 08:59:35 am »
Dear colleagues,

What I have to do to provide my Lazarus program with access to the MySQL database? It works perfect from my computer and from IT's ones but cannot connect from others.
libmysql.dll lies next to EXE-file but EXE-file doesn't see library and raises "Can't load default MySQL library "libmysql.dll" error.

Am I right that insalling MySQL from https://dev.mysql.com is the only solution? Are there some simplier options?

Thanks in advance.

JernejL

  • Jr. Member
  • **
  • Posts: 92
Re: MySQL client connections (they don't see libmysql.dll)
« Reply #1 on: July 28, 2020, 09:24:10 am »
usually libmysql is linked to visual studio runtime dependancies, so you need to install correct visual studio runtimes and the dll itself.
 
usually this manifests as if the dll is not found, because due to dependancies it will not load.
 

Vittorio

  • New Member
  • *
  • Posts: 32
Re: MySQL client connections (they don't see libmysql.dll)
« Reply #2 on: July 28, 2020, 11:13:10 am »
It means that I have to install MySQL in "Client only" mode at every PC that I want to use for my program?

af0815

  • Hero Member
  • *****
  • Posts: 1284
Re: MySQL client connections (they don't see libmysql.dll)
« Reply #3 on: July 28, 2020, 11:22:09 am »
... and use the correct bitness.

The dll must normally reside on two places - in the dir of the lazarus exe to use at designtime (with the bitness of lazarus) and later in the dir of the compiled exe or  in the system searchpath of libs.

It is posible to say SQL-DB or ZEOS where the dll resides.

Code: Pascal  [Select][+][-]
  1.   // In ZEOS
  2.          SQLConZEOS.DBLibLibraryName := 'driver.dll';  // Kompatibel mit Zeos
  3.   // In SQLDB
  4.        SQLConSQLDB.LibraryLocation:= 'driver.dll';
  5.  
You can also spezify dir names, but not relative. I have found out it works best with only full qualified path+filenames. At startup you didnt know where the actual startingpoint is.

An extra goal on windows - you must have the correct rights in the installation dir and the dlls.  And you must test or work with an dependencies walker for the correct dependencies of your used libs. Use an installer is a good option after this, to fullfill the requirements.

It means that I have to install MySQL in "Client only" mode at every PC that I want to use for my program?
You must only install the part you need for your app from the package. But you must know what you need and install correct with your installer.
« Last Edit: July 28, 2020, 11:25:37 am by af0815 »
regards
Andreas

JernejL

  • Jr. Member
  • **
  • Posts: 92
Re: MySQL client connections (they don't see libmysql.dll)
« Reply #4 on: July 28, 2020, 12:17:02 pm »
It means that I have to install MySQL in "Client only" mode at every PC that I want to use for my program?

 
no, just add the visual studio runtime installer that is needed - the msvcrxxxx dlls.
 
you can upload dll somewhere and we can check which runtime you need.
 

Vittorio

  • New Member
  • *
  • Posts: 32
Re: MySQL client connections (they don't see libmysql.dll)
« Reply #5 on: July 28, 2020, 01:18:12 pm »
Thanks all!

Is it possible to determine which runtime is needed if MySQL Server version = 5.5.XX and exe-file uses TMySQL57Connection?

JernejL

  • Jr. Member
  • **
  • Posts: 92
Re: MySQL client connections (they don't see libmysql.dll)
« Reply #6 on: July 29, 2020, 09:41:40 am »
Thanks all!

Is it possible to determine which runtime is needed if MySQL Server version = 5.5.XX and exe-file uses TMySQL57Connection?

 
The runtime depends on the dll and how that dll from mysql was compiled, not the mysqlconnection.
 
It can be checked by looking at the dll's import table.
 

Vittorio

  • New Member
  • *
  • Posts: 32
Re: MySQL client connections (they don't see libmysql.dll)
« Reply #7 on: August 04, 2020, 07:48:48 am »
I've traced DLL dependences with 'Dependency Walker' but it says nothing to me  :)
Maybe you could kindly help me to understand which runtimes do I need?

'Dependency Walker' image file is here.

P.S. msvcr120.dll is missing. Am I right that MS Visual C++ 2013 Redistributable x64 is reqired?
« Last Edit: August 04, 2020, 08:04:04 am by Vittorio »

PascalDragon

  • Hero Member
  • *****
  • Posts: 5444
  • Compiler Developer
Re: MySQL client connections (they don't see libmysql.dll)
« Reply #8 on: August 04, 2020, 09:09:36 am »
P.S. msvcr120.dll is missing. Am I right that MS Visual C++ 2013 Redistributable x64 is reqired?

Yes, that's the VS 2013 one. Install that and try again.

Vittorio

  • New Member
  • *
  • Posts: 32
Re: MySQL client connections (they don't see libmysql.dll)
« Reply #9 on: August 04, 2020, 09:56:06 am »
Perfect! That works!

 

TinyPortal © 2005-2018