Solved

MySQL errno: 2 when registering UDF

Posted on 2014-11-06
16
324 Views
Last Modified: 2014-11-22
I am getting the error message
Can't open shared library 'xxx.dll' (errno: 2 )
when registering a MySQL UDF with the following command
CREATE AGGREGATE FUNCTION xxx RETURNS REAL SONAME "xxx.dll";

I have my development machine running Windows 7 Pro x64 and MySQL community server 5.0.67 and want to "move" this to a new server running Windows Server 2012 R2 Standard. I have Installed MySQL community server 5.0.67, backed-up and restored the database to the new server. All working fine. I have a few UDFs I created years ago and need them on the new server as well. I copied the .dll files into the \bin directory, but get the above error when trying to register them.

What does error 2 mean?
0
Comment
Question by:DerekWatling
  • 9
  • 7
16 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 40427808
bin is the wrong folder:
http://dev.mysql.com/doc/refman/5.1/en/create-function-udf.html
The file must be located in the plugin directory. This directory is given by the value of the plugin_dir system variable.
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 40427809
errno 2 means in short: file not found
0
 

Author Comment

by:DerekWatling
ID: 40427841
Keeping in mind that I am running a 5.0 version, where would I verify which is the correct directory? This documentation states the "plugin_dir" system variable was added in MySQL 5.1.2.

I have looked at the Windows system variables and the only thing I can find is that the PATH contains "C:\Program Files\MySQL\MySQL Server 5.0\bin".

Searching the folders on thw working installation these DLLs are only in the "bin" directory.

My directory structure on both installations is very similar:

...
C:\Program Files\MySQL\MySQL Server 5.0
bin
data
    > ...
Docs
include
lib
    > debug
    > opt
share
    > ...
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

Author Comment

by:DerekWatling
ID: 40427853
I have found the coressponding 5.0 documentaion which states:
The path name of the plugin directory. This variable was added in MySQL 5.0.67. If the value is nonempty, user-defined function object files must be located in this directory. If the value is empty, the behavior that is used before 5.0.67 applies: The UDF object files must be located in a directory that is searched by your system's dynamic linker.
The version I am using MySQL 5.0.67 :-)
0
 
LVL 142

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 500 total points
ID: 40427855
http://dev.mysql.com/doc/refman/5.0/en/create-function-udf.html

As of MySQL 5.0.67, the file must be located in the plugin directory. This directory is given by the value of the plugin_dir system variable.

If the value of plugin_dir is empty, the behavior that is used before 5.0.67 applies: The file must be located in a directory that is searched by your system's dynamic linker. For more information, see Section 21.2.2.5, “Compiling and Installing User-Defined Functions”.
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 40427856
:)
0
 

Author Comment

by:DerekWatling
ID: 40427920
I have tried

1.

creating a Windows Environment System Variable
name                 value
plugin_dir          C:\Program Files\MySQL\MySQL Server 5.0\bin
Same error

2.

I then created a plugin subdirectory in "C:\Program Files\MySQL\MySQL Server 5.0\lib" and moved the DLLs in there.
Same error

3.

Removed the system variable
Same error
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 40427936
did you restart the mysql instance?
can you try to copy the dll into the windows system32 folder?
0
 

Author Comment

by:DerekWatling
ID: 40428029
No.
Yes.

It probably be only be on Monday, as I am in the middle of something else right now.

Thank you for the help and suggestions so far.
0
 

Author Comment

by:DerekWatling
ID: 40428140
Tried all of the above including putting in Sytem32 with restrting MySQL service inbetween. Consitently getting errno 0 now.
0
 
LVL 142

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 500 total points
ID: 40428205
it says failed with error 0 ? does not look consistent.
still it is likely a permission issue OR the .dll is 32/64 bit and the mysql is 64/32 bit (not compatbile...)
0
 

Author Comment

by:DerekWatling
ID: 40428242
Both 64bit.
0
 

Accepted Solution

by:
DerekWatling earned 0 total points
ID: 40446737
Using the instructions from http://www.mooreds.com/wordpress/archives/376 as a rough guide, and setting my project target platform as "x64", I re-compiled the udf on the new server. Copied the .dll to "C:\Program Files\MySQL\MySQL Server 5.0\bin" and it works.

My initial attempt at coping the existing dll, which was also compiled as x64 against MySQL 5.0.67, but on Windows Server 2008 R2 just refused to work on Windows Server 2012 R2.
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 40446934
hard-code stuff :)
0
 

Author Comment

by:DerekWatling
ID: 40447089
What I can say is that the process whs a lot smoother using Visual Studio 2013 Pro than when I originally compiled the udf with Visual C++ Express 2008...
0
 

Author Closing Comment

by:DerekWatling
ID: 40459232
The problem is somewhere in what it was compiled against. Guy sugested a bitness conflict (32 vs 64) which got hime the points.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MySQL query to show different levels from a table. 5 69
Best database setup for image uploads 6 64
Connect MySql database to wordpress site 3 67
paypal ipn to mysql 3 39
Introduction In this article, I will by showing a nice little trick for MySQL similar to that of my previous EE Article for SQLite (http://www.sqlite.org/), A SQLite Tidbit: Quick Numbers Table Generation (http://www.experts-exchange.com/A_3570.htm…
All XML, All the Time; More Fun MySQL Tidbits – Dynamically Generate XML via Stored Procedure in MySQL Extensible Markup Language (XML) and database systems, a marriage we are seeing more and more of.  So the topics of parsing and manipulating XM…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question