Lazarus

Programming => Databases => Topic started by: guest48180 on August 23, 2012, 09:28:55 pm

Title: Lazarus 9.30.2-2 and MySQL 5.5.24
Post by: guest48180 on August 23, 2012, 09:28:55 pm
Okay. I have MySQL installed and have created a db using the terminal. It's called employees. I have setup a table with a couple entries in it. I have worked with it in the term so I know it's there. But when I place a MySQL50Connection1 on my form and try to set the properties, all is good until I try to set the Connected feature on Lazarus to True. I get the following error msg:

Can not load default MySQL library ("libmysqlclient.so.15" or "libmysqlclient.so"). Check your installation.

I know the installation is good (or at least I think it is) because I created a database and have manipulated it from within the term. So why is it that I get this error when I try to Connect to the db in Lazarus? Is Lazarus trying to find these files in a different directory than the one it installed in? I watch all the online tutorials. I have read this and I've read that. But when it comes to trying to making it work in Lazarus...I haven't a clue. Has anyone faced the same as me? Or am I just a lost cause for doing what others seem to be able to do? Any insight here would be appreciated. Any at all. Thanks.
Title: Re: Lazarus 9.30.2-2 and MySQL 5.5.24
Post by: ezlage on August 23, 2012, 10:48:29 pm
Install the MYSQL Client.

In OpenSUSE:

zypper install mysql-client
Title: Re: Lazarus 9.30.2-2 and MySQL 5.5.24
Post by: ezlage on August 23, 2012, 10:53:02 pm
If is installed, find the file at disk, make a symbolic link at project path to the libmysql.so.

Sorry by my poor english.
Title: Re: Lazarus 9.30.2-2 and MySQL 5.5.24
Post by: BigChimp on August 24, 2012, 08:13:47 am
What ezlage said. Probably FPC/Lazarus is looking for the wrong library name.

Fixes for this have just been committed to current FPC code, but that of course won't help you as you have older code.

AFAIR, there is also a way to specify in your program exactly what mysql filename to load, but haven't used that...

Title: Re: Lazarus 9.30.2-2 and MySQL 5.5.24
Post by: dokhebi on December 07, 2012, 07:03:55 pm
I have the required library, but Lazarus can't find it.  How do I alter the library path so Lazarus *can* find it?  I've already altered the library path in Project Options -> Compiler Options -> Paths  but this doesn't seem to help.
Title: Re: Lazarus 9.30.2-2 and MySQL 5.5.24
Post by: BigChimp on December 07, 2012, 07:14:23 pm
That only helps for Pascal source code, not for compiled shared library dlls/so/dylib.

Please post your Lazarus version, operating system version etc when asking a question.

Also, please refer to the mysql page on the lazarus wiki and other instructions: make sure the mysql library version matches the connector; on Linux you may have to create a symlink or install the -dev package etc.
This stuff has been covered lots of times; please help others help you by doing a bit of research and specifying some details.
Thanks.
Title: Re: Lazarus 9.30.2-2 and MySQL 5.5.24
Post by: dokhebi on December 07, 2012, 07:59:18 pm
WinXP Pro
Lazarus 1.0.2
MySQL 5.5.27 (installed with XAMPP 3.1.0)
FPC (whatever version comes with L 1.0.2)

I've looked at the lazarus wiki and it mentioned to place it project output directory, is that the same as the project source files directory?  I can't see any references to "Project Output Directory" in the project options.

I placed the library with the project files and it still can't be found.  What next?
Title: Re: Lazarus 9.30.2-2 and MySQL 5.5.24
Post by: BigChimp on December 07, 2012, 08:09:27 pm
Thanks. Laz 1.0.x comes with FPC 2.6.0

The project output directory is where your exe file will be placed. That can be different from the source files. If it is different and the dll is not there, your program won't work (and you'll get an error when debugging the program in the IDE).

Are you sure you copied all required dlls (if there's more than one, haven't used mysql on Windows for a while)? Does the dll match bitness with your project (i.e. 32 bit dll with 32 bit applications; 64 bit applications with 64 bit dll).

So you're using the TMysql55connector, right?

Next up could be using sysinternals process monitor to follow the compiled application and see what dlls it tries to load... or wait for somebody who really uses mysql to chip in & help.
Title: Re: Lazarus 9.30.2-2 and MySQL 5.5.24
Post by: BlueIcaro on December 07, 2012, 09:00:32 pm
Why don't you use the lastes oficial release 1.04?
I think since 1.x version solved a lot of bugs/problems and it was a big jump in Lazarus.
/BlueIcaro
Title: Re: Lazarus 9.30.2-2 and MySQL 5.5.24
Post by: marcov on December 07, 2012, 09:01:21 pm
If you use a version of mysqlclient that needs additional libraries (libc,iconv,SSL), those need to be placed there too. Try to put all dlls of the mysql dir in the directory with the EXE.

If it then works, you can try to reduce the set again till you find the minimal set.
Title: Re: Lazarus 9.30.2-2 and MySQL 5.5.24
Post by: marcov on December 07, 2012, 09:03:15 pm
Hmm, think about it, even 2.6.0 doesn't have a 5.5 connector. Must have 2.6.2rc1 probably
Title: Re: Lazarus 9.30.2-2 and MySQL 5.5.24
Post by: BigChimp on December 07, 2012, 09:13:26 pm
Hmm, think about it, even 2.6.0 doesn't have a 5.5 connector. Must have 2.6.2rc1 probably
;)

You're right:
http://wiki.lazarus.freepascal.org/SQLdb_Package#TXXXConnection (http://wiki.lazarus.freepascal.org/SQLdb_Package#TXXXConnection)
... since 2.6.1/2.6.2RC1...

Does take away the suspense of waiting for the poster's answer to my question:
Quote
So you're using the TMysql55connector, right?
... even though I should've known that connector is not available ;)

@dokhebi: just to reiterate:
http://wiki.lazarus.freepascal.org/mysql#SQLDB (http://wiki.lazarus.freepascal.org/mysql#SQLDB)
Quote
Make sure you are using the correct connection component for your client library version. So if you have the client libraries installed for MySQL 4.1 then you have to use TMySQL41Connection component, even if the server is running version 4.0 or 5.0
Title: Re: Lazarus 9.30.2-2 and MySQL 5.5.24
Post by: BigChimp on December 07, 2012, 09:14:13 pm
If you use a version of mysqlclient that needs additional libraries (libc,iconv,SSL), those need to be placed there too. Try to put all dlls of the mysql dir in the directory with the EXE.
Ehm yes, as I said in an earlier post ;)
Title: Re: Lazarus 9.30.2-2 and MySQL 5.5.24
Post by: dokhebi on December 07, 2012, 10:08:25 pm
I put libmysql.dll in c:\Windows\System32 and it found it...  But now it says it's the wrong version.  I was expecting that when I saw that there *is* a component for MySQL 5.5 (somewhere).  I had a fleeting thought that the 5.1 component would work since I downloaded Lazarus 1.0.2 last month (it was the current version at the time) and MySQL 5.5 has been out for some time.

I have downloaded Laz 1.0.4 an will install in a moment but I want to ask, are there any plans to add an update feature to Lazarus so it will look for pieces that have changed, then download and install them?

Thanks!
Title: Re: Lazarus 9.30.2-2 and MySQL 5.5.24
Post by: dokhebi on December 07, 2012, 10:33:50 pm
Lazarus 1.0.4 does not have TMySQL55Connect.  Where do I get this component?
Title: Re: Lazarus 9.30.2-2 and MySQL 5.5.24
Post by: bobo on December 07, 2012, 10:42:22 pm
While it is fixed, you can use ZeosLib from
http://zeos.firmos.at/viewtopic.php?t=3606

I am using Zeos in the past 5 years and it works perfectly. The latest 7.0.1beta is 100% stable for me both on Win32/Win64 and Linux32/Linux64.
Title: Re: Lazarus 9.30.2-2 and MySQL 5.5.24
Post by: BigChimp on December 08, 2012, 10:05:58 am
Lazarus 1.0.4 does not have TMySQL55Connect.  Where do I get this component?
Looking into the way you seem to be reading the wiki articles, I suggest you don't. Just use the 5.1 DLL.
Title: Re: Lazarus 9.30.2-2 and MySQL 5.5.24
Post by: psychojock on December 14, 2012, 11:58:48 am
I have had this problem when writing using Lazarus on Ubuntu 10.04 and 12.04.  The way I solved it was found the correct version on the web and downloaded it, putting it with the other mysql .so files.

Good luck ;)
Title: Re: Lazarus 9.30.2-2 and MySQL 5.5.24
Post by: marcov on December 14, 2012, 12:55:48 pm
While it is fixed, you can use ZeosLib from
http://zeos.firmos.at/viewtopic.php?t=3606

I am using Zeos in the past 5 years and it works perfectly. The latest 7.0.1beta is 100% stable for me both on Win32/Win64 and Linux32/Linux64.

If you use FPC and Lazarus from SVN or RCs, it wouldn't be a problem here either.

The problem is that mysql is chronically incompatible to itself, and the updates that fix that on FPC are in sync with yearly refresh cycles.
TinyPortal © 2005-2018