The requirement is to receive an SQL query(over tcp) from a client(which is using a mysql client library - libmysqlclient.so.16.0.0) and then convert it to an LDAP request and send out to an LDAP server.

The reason is that the client cannot be changed to use the LDAP interface, so I am looking to include a component that can reside between the MySQL client and the LDAP server.

I have tried looking at the MySQL server plug-ins but I could not get something that matches my requirement. Do you have any recommendations?

Edit: The SQL query in this case is a "SELECT" statement. So in this case the LDAP results received(usually one row and just one column), needs to be sent back as an SQL response.

1 Answer 1


Very tricky requirement, I doubt a ready-to-use solution is available.

Here is something you can try:

  1. Use a normal MySQL database with tables defined for your needs mimicking LDAP nouns and verbs.
  2. Write MySQL triggers for each table.
  3. In the MySQL triggers, call sys_exec() then do some housekeeping (for instance after an INSERT remove the inserted MySQL row).
  4. In the external program you just called using sys_exec(), perform the actual LDAP calls via your favorite LDAP client library.

That's still very hacky.

Reference: https://dev.mysql.com/doc/refman/8.0/en/faqs-triggers.html#faq-mysql-can-triggers-udf

Edit: To use that technique with SELECT, use a BEFORE trigger.

  • Thanks for your quick response. I have edited the question to include more details about the nature of the request and response. Commented May 28, 2019 at 7:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.