Recent

Author Topic: Zeos/MariaDB: Instead of Embedded libmysqld.dll, Using mysqld.exe via named pipe  (Read 1918 times)

PaulANormanNZ

  • Jr. Member
  • **
  • Posts: 99
Hi,

I want to use Mariadb (64bit) as effectly embedded, with Zeos components,
and have been trialing with the supplied 
Code: Text  [Select][+][-]
  1. zeosdbo\examples\embedded\Embedded.lpr
and a 28 ‎January ‎2018, 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: Text  [Select][+][-]
  1. \mariadb-10.5.9>cmake . -DWITH_EMBEDDED_SERVER=1 && cmake --build . --config rel
  2. withdebinfo --target libmysqld

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:--

Code: Text  [Select][+][-]
  1. Embedded provides some convenience, I agree, but this convenience is minimal.
  2.  
  3. You can achieve the same effect as embedded rather trivially , by starting:
  4.  
  5. mysqld.exe --skip-networking --enable-named-pipe --named-pipe=<some-unique-name>
  6.  
  7.  instead of mysql_library_init()
  8.  
  9. and connecting via normal C API, libmariadb.dll, via this named pipe <some-unique-name>.
  10.  
  11. This does not need mysqld.exe to be:
  12.  
  13. - run as service,
  14. - doesnot use TCP port,
  15. - does not need any privileges.
  16.  
  17.  

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:

Code: Text  [Select][+][-]
  1. https://mariadb.com/kb/en/configuring-mariadb-connectorc-with-option-files/#pipe
  2.  
  3. MYSQL_OPT_NAMED_PIPE
  4. MYSQL_OPT_PROTOCOL=3
  5.  
  6.  
  7. https://mariadb.com/kb/en/connecting-to-mariadb/
  8.  
  9. pipe
  10.  
  11. --pipe
  12. -W
  13.  
  14. 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.
  15.  
  16.  
  17. protocol
  18.  
  19. --protocol=name
  20.  
  21. 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.
  22.  
  23.     TCP: A TCP/IP connection to a server (either local or remote). Available on all operating systems.
  24.     SOCKET: A Unix socket file connection, available to the local server on Unix systems only.
  25.     PIPE. A named-pipe connection (either local or remote). Available on Windows only.
  26.     MEMORY. Shared-memory connection to the local server on Windows systems only.

Kind regards,

Paul

Lazarus 2.0.8 r62944 FPC 3.0.4 x86_64-win64-win32/win64
Windows 8.1 Prof

af0815

  • Hero Member
  • *****
  • Posts: 655
regards
Andreas

PaulANormanNZ

  • Jr. Member
  • **
  • Posts: 99
Thanks af0185,

I'll check out there if there is no other Lazarus solution coming forward here, that's why I put Zeos(?) In my question, in case someone already had a better Lazarus solution even apart from Zeos as none of this seems to be encompassed in their embedded example, I just didn't want to cross post yet.

Thanks,
Paul

af0815

  • Hero Member
  • *****
  • Posts: 655
Changing the drivers is not an easy solution, nor in SQLDb nor in ZEOS. This is no Lazarus question, because the connection object itself is located in FPC. Lazarus have only a thin Layer to make it more RAD.

So the question goes more to the core team of fpc or zeos. Both have the experience to create new connection types.
regards
Andreas

 

TinyPortal © 2005-2018