Forum > Database

MySql with Lazarus

(1/2) > >>

Handas:
Hello,

I was trying it for hours, but i cant find a answer. I hope that u can help me.
I try to connect to an MySql Database with Lazarus.
I use the TMySQL55Connection Component and downloaded the MySql Server 5.5.
The libmysql.ddl is already in my project, System32 and Lazarus directory.
But if i try to connect, i get the error message: "Can not load default MySql Libary ('libmysql.dll' or 'libmysql.dll') Check your installation"

Thanks for helping

rvk:
Is the libmysql.dll the 32bit version or the 64bit version?
It must match your target.exe of your project.

Also... System32 on a 64bit OS is where the 64bit dll's go.
SysWOW64 is where the 32bit dll's go on a 64bit OS.

But it should be sufficient to have them in your project directory (and the Lazarus directory if you want to run it from the IDE).

jc99:
@Handas:
If you haven't already done it, you should add $(TargetCPU)-$(TargetOS)(one or both) to your out-path.
that way the DLL-files don't mix since they often have the same name. ([Of Topic:] I think this is a M$-design-error)

BTW, Does anyone know how to do it without the DLL's ?
(Since i am a monolith-guy, one file (an EXE) that must do it.)

rvk:

--- Quote from: jc99 on June 15, 2015, 03:02:32 am ---BTW, Does anyone know how to do it without the DLL's ?
(Since i am a monolith-guy, one file (an EXE) that must do it.)

--- End quote ---
I'm not aware of an option to use a MySQL server without using the client-library dynamically loaded.

However... here is one example of using the SQLite-client library statically loaded and linked in (although not the MySQL one).
http://forum.lazarus.freepascal.org/index.php/topic,15712.msg84781.html#msg84781
(Maybe it's adaptable for MySQL)

Another option would be to include the DLL as a resource and writing it to disk before using it.

And yet another option would be loading the DLL direct from resource but I've only done this with Delphi once.

taazz:

--- Quote from: jc99 on June 15, 2015, 03:02:32 am ---BTW, Does anyone know how to do it without the DLL's ?
(Since i am a monolith-guy, one file (an EXE) that must do it.)

--- End quote ---
The license that comes along with mysql do not allow you to share the client dlls with your comercial application with out purchasing a commercial license. So unless you want to share the source code of your application I suggest that you stay away of statically linking mysql in to your application. There is a way ofcourse to avoid using the client library if you are dead set on it but it requires that you rewrite its functionality using sockets for communication.

Navigation

[0] Message Index

[#] Next page

Go to full version