I am running a mysql query in mysql editor:

select RegExCapture('sdfdj250043', '[a-zA-Z]{2}[0-9]{6}' );

Getting error: Function doesnot exist

Trying to register the dll in mysql:

CREATE FUNCTION RegExCapture1 RETURNS STRING SONAME 'RegExCapture.dll';
Getting error:SQL error(1126): Can't open shared library 'RegExCapture.dll'(errno:0)

Can anybody help, where I am missing.
Thanks in advance.

Dani AI

Generated

Brief summary and practical next steps for (and thanks to for the UDF guide pointer).

mysqld error 1126 means the server could not open the shared library you asked it to load. Typical root causes are: the library isn’t in the server’s plugin directory, a native dependency the DLL needs isn’t available to the server process, the DLL was built for a different architecture (32 vs 64 bit), required UDF auxiliary symbols (init/deinit) are missing, or the server user lacks permission to read the file. (dev.mysql.com)

Short troubleshooting checklist (do these in order):

  • Find the server plugin directory and place the UDF DLL there; the server only loads UDFs from that location. Run this in mysql to check:

    SHOW VARIABLES LIKE 'plugin_dir';

    Then copy the DLL and restart the server. (dev.mysql.com)

  • If the UDF library depends on other native libraries (for regex UDFs this is common), make sure those DLLs are reachable by mysqld (PATH or MySQL\bin on Windows). Moving a dependency to the server bin folder has resolved the same errno:0 failure for others. (bugs.mysql.com)

  • Confirm the DLL was built for the same bitness as the server and that it exports the expected UDF symbols; unresolved symbols or wrong format will block loading. On *nix compile with position-independent code; on Windows verify exports and runtime dependencies. (stackoverflow.com)

  • Check file ownership and permissions so the MySQL server process can read the file. Also remember you need the appropriate privilege to create a loadable function (mysqld writes mysql.func). (dev.mysql.com)

If those steps don’t fix it, run a dependency checker (Dependency Walker on Windows, ldd on Linux) against the DLL to find missing libraries, and share the exact mysqld version and whether the server is 32/64-bit. This thread’s error is classic for a missing dependency or placement problem — copying the UDF DLL (and any helper DLLs) into the server’s plugin/bin folder and ensuring matching architecture usually resolves it. (bugs.mysql.com)

Recommended Answers

All 2 Replies

See this thread, it has a link to a page about creating and installing UDF's.

Thanks. But I am using the same procedure, but getting the errors mentioned in the post. :(

Getting error : SQL error(1126): Can't open shared library 'RegExCapture.dll'(errno:0)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.