Recent

Author Topic: [solved] OSX -> remote mySQL DB connection errors  (Read 4539 times)

Fripsy

  • New Member
  • *
  • Posts: 14
[solved] OSX -> remote mySQL DB connection errors
« on: October 30, 2015, 09:07:47 am »
Hi All,

I'm trying to connect to a remote mySQL server with Lazarus from OSX, but I can't get it to work...

Here is what I did:

New project with only a TSQLDBLibraryLoader, TMySQL55Connection and a TSQLTransaction.
I first tried this on Windows with the proper libmysql.dll to be sure I can connect to the DB.
On OSX, I load the libmysqlclient.18.dylib in the TSQLDBLibraryLoader, put the ConnectionType to MySQL 5.5 and tried to enable... Success !

After this succes, 2 problems immerge:
  • If I set the Connected property of TMySQL55Connection to true during design time I get the following error:

    Cannot load default MySQL library ( "libmysqlclient.dylib.18" or " libmysqlclient.dylib"). Check your installation.

    Notice the reverse order of 18 and dylib in the message as to the filename

  • When I do this at runtime, I get a different error:

    TMySQL55Connection can not work with the installed MySQL client version: Expected (5.5), got (6.1.6).
In fact the library libmysqlclient.18.dylib comes from the MySQL connector 6.1.6, but as I read somewhere, it should not report its version as 6.1.6 but as 5.5 as set in the ConnectionType property of the TSQLDBLibraryLoader.

The first error isn't a big deal, as long the program works at runtime, so it's really the second error that is puzzling me the most...

I should note that installing MySQL on the OSX machine isn't an option as the final program has to run on third party machines through a simple installation (which will be my next question when I'll get the above working...).

This is the configuration I'm using:
Lazarus 1.4.4
FPC 2.6.4
i386-darwin-carbon
OSX 10.11.1 El Capitan

Thanks for any input,
Frank.
« Last Edit: November 02, 2015, 08:48:42 am by Fripsy »
Lazarus 1.4.0 r48774 FPC 2.6.4 i386-win32-win32/win64

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1739
Re: OSX -> remote mySQL DB connection errors
« Reply #1 on: October 30, 2015, 11:28:37 am »
For my app, I use Zeos to connect with MySQL (or, in my case MariaDB).

To get it working, I had to create symlinks on the Mac machine.
The default lib-installer installs the mysql dylib in a directory /usr/local/.....
FPC expects driver in /usr/lib

Due to the reverse 18.dylib <-> dylib.18, you should link to the plain library libmysqlclient.dylib

To deploy on other machines, you have to include the library in your app-bundle !

Fripsy

  • New Member
  • *
  • Posts: 14
Re: OSX -> remote mySQL DB connection errors
« Reply #2 on: October 30, 2015, 11:45:50 am »
Thanks DonAlfredo,

The first problem is now resolved  ::).

Now, during design and runtime the second error is showing:

TMySQL55Connection can not work with the installed MySQL client version: Expected (5.5), got (6.1.6).

Any clues on that one ?
Lazarus 1.4.0 r48774 FPC 2.6.4 i386-win32-win32/win64

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1739
Re: OSX -> remote mySQL DB connection errors
« Reply #3 on: October 30, 2015, 12:20:26 pm »
Well, the easiest is to use an old driver !

You can find them everywhere on the web. An example:
https://downloads.mariadb.com/archives/mysql-5.5/mysql-5.5.25a-osx10.6-x86.tar.gz

Just unpack the archive, and in the lib-dir you will find your 5.5 connector !!

For myself, I just change the sources of Zeos to use the lastest.

Fripsy

  • New Member
  • *
  • Posts: 14
Re: OSX -> remote mySQL DB connection errors
« Reply #4 on: October 30, 2015, 12:50:23 pm »
Thanks again DonAlfredo,

with that old driver it is working, didn't think of searching for it at MariaDB (and I'm connecting to MariaDB  :-X).

I now just have to figure out how to put the lib in the .app folder (easy using Windows) and, more importantly, how to tell the TSQLDBLibraryLoader that the lib is in the .app folder (which on OSX is an app, not a folder).

Thanks again.
Frank.
Lazarus 1.4.0 r48774 FPC 2.6.4 i386-win32-win32/win64

 

TinyPortal © 2005-2018