Recent

Author Topic: [Help] What I'm doing wrong with these connection components?  (Read 5114 times)

MichelGuedes

  • Newbie
  • Posts: 2
[Help] What I'm doing wrong with these connection components?
« on: November 17, 2017, 02:20:59 pm »
Hello to all,

Can you please help me and shed some light on this one? Not sure if I have skipped a step on the installation or missing some sort of configuraiton...

This happens in two different computers (one with Win7 and other with Win10), and two different Lazarus installations. When I try to use a SQL connection database (MySql, MSSQL, doesn't matter) I get an error similar to this one:

"Exception "EInOutError" with message:

Can not load default <SQLConnection here> library ("lib<something>.dll). Check your installation."

Do you know if I'm doing something wrong? I have already searched this forum and Google, already copied the missing .dll to my project folder with the project .exe file, copied the dll to System32, System and SysWoW64 folders under Windows as well. Seems like there's a missing configuration somewhere that I'm not able to find yet... I have even used the SQLDBLibraryLoader component, but no luck either.

Appreciate any help ;)
Michel
« Last Edit: November 17, 2017, 02:27:13 pm by MichelGuedes »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11351
  • FPC developer.
Re: [Help] What I'm doing wrong with these connection components?
« Reply #1 on: November 17, 2017, 04:33:14 pm »
Make sure that the binary is the same kind as the application (both 32-bit or both 64-bit) and have the exact same name.


MichelGuedes

  • Newbie
  • Posts: 2
Re: [Help] What I'm doing wrong with these connection components?
« Reply #2 on: November 19, 2017, 11:13:10 pm »
Hey there,

Many thanks for your reply. If I understand correctly, my Lazarus app is x86 and the MySQL DLL is the one that comes with Lazarus as well.

So, I believe both are 32 bits. About the "exact the same name" you mention, not sure on that...

Thanks again,
Michel

Leledumbo

  • Hero Member
  • *****
  • Posts: 8744
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: [Help] What I'm doing wrong with these connection components?
« Reply #3 on: November 20, 2017, 04:16:37 am »
the MySQL DLL is the one that comes with Lazarus as well.
Lazarus does NOT ship with any DBMS dll.

RedwoodHat

  • Newbie
  • Posts: 4
Re: [Help] What I'm doing wrong with these connection components?
« Reply #4 on: December 15, 2017, 08:10:56 am »
I'm having the same symptoms/problem.  I'm new to Lazarus.  I downloaded the 32 bit version and tried to connect to MySQL, using the code here: http://wiki.freepascal.org/MySQLDatabases

I get the same message as the original poster.  I have put libmysql.dll (from the 5.7 32-bit MySQL installation) in the same places he did, and I'm still getting that error.  I'm using the TMySQL57Connector with this code:

    MySQLConnection1.HostName := 'localhost';
    MySQLConnection1.UserName := 'root';  // i know, this is is proof of concept/test
    MySQLConnection1.Password := 'mypassword';
    MySQLConnection1.DatabaseName := 'mysql'; // MySQL is allways there!
    MySQLConnection1.Open;
 
Nothing I've tried words. I get the libmysql error message on the open.  Am I doing something wrong?

-Jim

Thaddy

  • Hero Member
  • *****
  • Posts: 14159
  • Probably until I exterminate Putin.
Re: [Help] What I'm doing wrong with these connection components?
« Reply #5 on: December 15, 2017, 08:16:13 am »
As Leledumbo explained:
Lazarus nor FPC come with any dbms libraries. You have to install them. FPC just provide bindings. And you can not use a 32 bit library on a 64 bit Lazarus. May that be the case?
Specialize a type, not a var.

RedwoodHat

  • Newbie
  • Posts: 4
Re: [Help] What I'm doing wrong with these connection components?
« Reply #6 on: December 15, 2017, 08:37:30 am »
As I said, I used the libmysql.dll file that was installed with MySQL, not Lazarus.  Both Lazarus and MySQL Server 5.7.2  are 32-bit, so the .dll that came with MySQL should also be 32-bit.  I actually originally installed the 64-bit MySQL server, but this seems to be a problem (to my surprise), so I uninstalled 64-bit MySQL and installed 32-bit MySQL (and picked up the 32-bit libmysql.dll file, which I placed in the execution directory and  in the Windows system directories the original poster mentioned).

-Jim

Thaddy

  • Hero Member
  • *****
  • Posts: 14159
  • Probably until I exterminate Putin.
Re: [Help] What I'm doing wrong with these connection components?
« Reply #7 on: December 15, 2017, 09:57:55 am »
Well I just tested both a 32 bit install and a 64 bit install and I do not have ANY problems. I simply can't reproduce it.
Specialize a type, not a var.

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: [Help] What I'm doing wrong with these connection components?
« Reply #8 on: December 15, 2017, 11:11:54 am »
@RedwoodHat:
In case you are absolutely positively sure you've installed the correct .dll then make sure that the .dll is able to resolve all its dependencies. Since you are on a 64 bit system there might be something missing from your 32-bit setup.

RedwoodHat

  • Newbie
  • Posts: 4
Re: [Help] What I'm doing wrong with these connection components?
« Reply #9 on: December 15, 2017, 11:14:12 am »
I appreciate your help!  You convinced me that it's my fault, by going the extra mile and trying to reproduce the problem.  So I uninstalled and re-installed, and it's now working for me.  I'm able to connect to a 64-bit MySQL server, using a 32-bit libmysql.dll in the application directory.

Again, thanks so much, I appreciate your time.

-Jim

Thaddy

  • Hero Member
  • *****
  • Posts: 14159
  • Probably until I exterminate Putin.
Re: [Help] What I'm doing wrong with these connection components?
« Reply #10 on: December 15, 2017, 02:04:09 pm »
Jim, plz note a 32 client can connect to a 64 bit server and the other way around. Maybe there was the misunderstanding?
As long as client and server are written with the correct bitness, it is opaque. As long as the client can find a 32 bit library and the server can find a 64 bit library or the other way around.
« Last Edit: December 15, 2017, 02:06:17 pm by Thaddy »
Specialize a type, not a var.

RedwoodHat

  • Newbie
  • Posts: 4
Re: [Help] What I'm doing wrong with these connection components?
« Reply #11 on: December 15, 2017, 09:20:16 pm »
Yes, thanks for the explanation.  I did think that I should be able to connect to a 64-bit MySQL, and of course I can.  The whole thing was my fault - I thought I had installed 32-bit MySQL (the web site link said so) but it was actually 64 bit, so I didn't have the correct dll.  I had to download a .zip archive of the 32 bit MySQL just to get the correct .dll.

Thanks for the help!

-Jim

 

TinyPortal © 2005-2018