I am using MySQL 5.6.11 running on 32-bit Microsoft Windows XP (Professional Version 2002 Service Pack 3). I installed the MySQL sys_exec
UDF. Since I am running on 32-bit Windows, I used this lib_mysqludf_sys.dll (placed under C:\Program Files\MySQL\MySQL Server 5.6\lib\plugin\
as it is the default installation).
Afterwards, the following command was executed (after logging in into an already created database).
mysql> CREATE FUNCTION sys_exec RETURNS INT SONAME 'lib_mysqludf_sys.dll';
Query OK, 0 rows affected (0.02 sec)
I had already created a PL/SQL stored procedure as follows.
DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `country_push`()
BEGIN
SET @result=sys_exec('curl http://localhost:8080/ContextPath/push-update-country');
END
This procedure is supposed to be invoked by database triggers (which is adequately done) and accordingly, it should raise an HTTP GET request on the said URL but no HTTP GET request is raised on the URL, when this stored procedure is executed by a trigger on a certain event.
Manually executing the procedure on the command line succeeds as well, as follows.
mysql> CALL country_push();
Query OK, 0 rows affected (0.08 sec)
The sys_exec()
function returns 1
as follows which is a success flag.
mysql> SELECT sys_exec('curl http://localhost:8080/ContextPath/push-update-country')
AS result;
+--------+
| result |
+--------+
| 1 |
+--------+
1 row in set (0.06 sec)
There is already a Java Servlet running on GlassFish (4.1) application server which is supposed to listen to this HTTP GET request as follows.
@WebServlet(name = "PushCountry", urlPatterns = {"/push-update-country"})
public class PushCountry extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("PushCountry called.");
}
}
The line System.out.println("PushCountry called.");
in the doGet()
method produces nothing on the server terminal (because it is not executed/invoked), when the above-mentioned MySQL stuff is put into practice.
Is it not practical to do this using MySQL, is there something else I might be missing or is it the old EOL dinosaur : Windows XP?
The shared Dynamic Link Library I am using might not be suitable. Please clarify, if such is a case as this is beyond me.
EDIT:
When entering,
mysql> SELECT sys_eval('id');
MySQL terminates/crashes with the following error report.
On closing this dialog, MySQL leaves the following error message.
ERROR 2013 (HY000): Lost connection to MySQL server during query
It fails to reconnect until/unless the system itself is restarted.
Perhaps, I will think of reinstalling the operating system itself later on.
sys_eval()
function? Maybe a useful error message? – Michael - sqlbotSELECT sys_eval('id');
. A popup appears all of a sudden indicating :mysqld.exe has encountered a problem and needs to close. We are sorry for the inconvenience.
When closing this dialog, this messageERROR 2013 (HY000): Lost connection to MySQL server during query
prompts on the command line. MySQL stops working forever then onwards until the system itself is restarted. – Tiny