Skip to content
Advertisement

Lost connection to MySQL server during aggregate UDF execution

I created a MySQL UDF in C++ and uploaded it into the MySQL’s plugin directory. I am able to install the UDF in MySQL, but when I try to call it, the MySQL server stops. I am using visual studio 2019 to create the shared library(.dll in windows) on windows 10 operating system.

I am calling a method from java in my MySQL C++ UDF, I am using graalVM to call the java methods from C++ functions.

I created a shared library out of my java code and I use them in my C++ code to access my java methods.

MySQL UDF code:DemoAgg.cpp

JavaScript

My Module Definition File:DemoAgg.def

JavaScript

My java code:

JavaScript

After building my C++ project, I get a dll file which I copy to the MySQL’s plugin directory.

I install the UDF using the following query:

JavaScript

I call my UDF using the following query:

JavaScript

where,

demo_agg is a table with only one column.

c1 is the column name of type integer.

But when I execute the above query, the following error pops up:

JavaScript

My error log:

JavaScript

I put some cout statements to know in which function I am.

Can anyone help me out here? What I am doing here? Any kind of help or suggestion will be of great help.

Advertisement

Answer

the problem is with:

JavaScript

they are null, that’s why it is not able to call the java method and the connection is getting timed out.

if I initialize them like this:

JavaScript

then it is working fine.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement