Zeos/MariaDB/Lazarus: Instead of Embedded libmysqld.dll, Using mysqld.exe via named pipe
Posted: 07.03.2021, 05:54
Hi,
(Cross Post advisory :-)
I originally posted over on Lazarus Forum but the feeling there is that I need to post here.
https://forum.lazarus.freepascal.org/in ... #msg396683
I am using:
ZeosLib 7.2.8.0 from the Lazarus "Online Package Manager"
Lazarus 2.0.8 r62944 FPC 3.0.4 x86_64-win64-win32/win64
Windows 8.1 Prof
I want to use Mariadb (64bit) as effectly embedded, with Zeos components,
and have been trialing with the supplied converted from Delphi to Lazarus .lpi
and a 28 January 2018 version 10.2.12.0, copy of libmysqld.dll from a Mariadb support forum enetereed as TZConnection.LibraryLocation, but can neither get it recognised under TZConnection.Protocol as any available Mariadb or MySql setting at all.
(Mariadb have not been supplying binary releases of libmysqld.dll since early version 10 for a while now saying that they haven't the Windows based resources to do it, and no one else seems to have filled the gap.)
So I looked into building my own libmysqld.dll - but that is pretty problamatic it seems on Windows, the current MariaDB build advice page does not even seem (as far as I can tell) to list instructions for (libmysqld) libmysqld.dll (unless it is renamed now?) as a target at all any longer.
https://mariadb.com/kb/en/Building_MariaDB_on_Windows/
The general kind of advice used to be for example ...
But that is just not going to happen. Too many compile problems even with their reccomended Visual Studio 2019 (Community Edition) from the comand line.
Then I read a reference (for C languages):
https://jira.mariadb.org/plugins/servlet/mobile#issue/MDEV-15100/comment/106350
--- for avoiding the embeded version all together and to now instead use arguments on starting MariaDB:--
Sounds absolutely ideal for our purposes. And keeps away from the (ongoing) .dll situation.
Does any one please have any advice on how that could be done under Lazarus wth Zeos(?) components?
Here is some info from the MariaDb api reference:
Any advice or pointers appreciated please - even a good repository for precompiled Mariadb libmysqld.dll and share folder etc.
Kind regards,
Paul
ZeosLib 7.2.8.0 from the Lazarus "Online Package Manager"
Lazarus 2.0.8 r62944 FPC 3.0.4 x86_64-win64-win32/win64
Windows 8.1 Prof
(Cross Post advisory :-)
I originally posted over on Lazarus Forum but the feeling there is that I need to post here.
https://forum.lazarus.freepascal.org/in ... #msg396683
I am using:
ZeosLib 7.2.8.0 from the Lazarus "Online Package Manager"
Lazarus 2.0.8 r62944 FPC 3.0.4 x86_64-win64-win32/win64
Windows 8.1 Prof
I want to use Mariadb (64bit) as effectly embedded, with Zeos components,
and have been trialing with the supplied
Code: Select all
zeosdbo\examples\embedded\Embedded.lpr
and a 28 January 2018 version 10.2.12.0, copy of libmysqld.dll from a Mariadb support forum enetereed as TZConnection.LibraryLocation, but can neither get it recognised under TZConnection.Protocol as any available Mariadb or MySql setting at all.
(Mariadb have not been supplying binary releases of libmysqld.dll since early version 10 for a while now saying that they haven't the Windows based resources to do it, and no one else seems to have filled the gap.)
So I looked into building my own libmysqld.dll - but that is pretty problamatic it seems on Windows, the current MariaDB build advice page does not even seem (as far as I can tell) to list instructions for (libmysqld) libmysqld.dll (unless it is renamed now?) as a target at all any longer.
https://mariadb.com/kb/en/Building_MariaDB_on_Windows/
The general kind of advice used to be for example ...
Code: Select all
\mariadb-10.5.9>cmake . -DWITH_EMBEDDED_SERVER=1 && cmake --build . --config rel
withdebinfo --target libmysqld
Then I read a reference (for C languages):
https://jira.mariadb.org/plugins/servlet/mobile#issue/MDEV-15100/comment/106350
--- for avoiding the embeded version all together and to now instead use arguments on starting MariaDB:--
Code: Select all
Embedded provides some convenience, I agree, but this convenience is minimal.
You can achieve the same effect as embedded rather trivially , by starting:
mysqld.exe --skip-networking --enable-named-pipe --named-pipe=<some-unique-name>
instead of mysql_library_init()
and connecting via normal C API, libmariadb.dll, via this named pipe <some-unique-name>.
This does not need mysqld.exe to be:
- run as service,
- doesnot use TCP port,
- does not need any privileges.
Does any one please have any advice on how that could be done under Lazarus wth Zeos(?) components?
Here is some info from the MariaDb api reference:
Code: Select all
https://mariadb.com/kb/en/configuring-mariadb-connectorc-with-option-files/#pipe
MYSQL_OPT_NAMED_PIPE
MYSQL_OPT_PROTOCOL=3
https://mariadb.com/kb/en/connecting-to-mariadb/
pipe
--pipe
-W
On Windows systems that have been started with the --enable-named-pipe option, use this option to connect to the server using a named pipe.
protocol
--protocol=name
Specifies the protocol to be used for the connection for the connection. It can be one of TCP, SOCKET, PIPE or MEMORY (case-insensitive). Usually you would not want to change this from the default. For example on Unix, a Unix socket file (SOCKET) is the default protocol, and usually results in the quickest connection.
TCP: A TCP/IP connection to a server (either local or remote). Available on all operating systems.
SOCKET: A Unix socket file connection, available to the local server on Unix systems only.
PIPE. A named-pipe connection (either local or remote). Available on Windows only.
MEMORY. Shared-memory connection to the local server on Windows systems only.
Any advice or pointers appreciated please - even a good repository for precompiled Mariadb libmysqld.dll and share folder etc.
Kind regards,
Paul
ZeosLib 7.2.8.0 from the Lazarus "Online Package Manager"
Lazarus 2.0.8 r62944 FPC 3.0.4 x86_64-win64-win32/win64
Windows 8.1 Prof