Ham Radio
Ham Radio, Electronics, Software and more...

Home » Electronics » Arduino » Arduino with MySQL Client Connector (Arduino with MySQL Client Connector)
Arduino with MySQL Client Connector [message #3298] Wed, 29 January 2020 15:20
kc2nda is currently offline  kc2nda
Messages: 46
Registered: December 2004
Location: New Paltz
Member
Since I couldn't get the Arduino to work with SSL, I used these modules by Chuck Bell to connect an Arduino to the network. https://github.com/ChuckBell/MySQL_Connector_Arduino

I Setup MySQL's sys_exec function to run an external php script using a MySQL trigger.

gcc -DMYSQL_DYNAMIC_PLUGIN -fPIC -Wall -m64 -I/usr/include/mysql -I. -shared lib_mysqludf_sys.c -o lib_mysqludf_sys.so

mysql> SHOW VARIABLES LIKE 'plugin_dir';
+---------------+------------------------+
| Variable_name | Value |
+---------------+------------------------+
| plugin_dir | /usr/lib/mysql/plugin/ | -- copy 'lib_mysqludf_sys.so' here
+---------------+------------------------+
1 row in set (0.01 sec)

mysql> DROP FUNCTION IF EXISTS lib_mysqludf_sys_info;
Query OK, 0 rows affected, 1 warning (0.00 sec)


mysql> DROP FUNCTION IF EXISTS sys_get;
Query OK, 0 rows affected, 1 warning (0.00 sec)


mysql> DROP FUNCTION IF EXISTS sys_set;
Query OK, 0 rows affected, 1 warning (0.00 sec)


mysql> DROP FUNCTION IF EXISTS sys_exec;
Query OK, 0 rows affected, 1 warning (0.00 sec)


mysql> DROP FUNCTION IF EXISTS sys_eval;
Query OK, 0 rows affected, 1 warning (0.00 sec)


mysql> CREATE FUNCTION lib_mysqludf_sys_info RETURNS string SONAME 'lib_mysqludf_sys.so';
Query OK, 0 rows affected (0.00 sec)


mysql> CREATE FUNCTION sys_get RETURNS string SONAME 'lib_mysqludf_sys.so';
Query OK, 0 rows affected (0.00 sec)


mysql> CREATE FUNCTION sys_set RETURNS int SONAME 'lib_mysqludf_sys.so';
Query OK, 0 rows affected (0.00 sec)


mysql> CREATE FUNCTION sys_exec RETURNS int SONAME 'lib_mysqludf_sys.so';
Query OK, 0 rows affected (0.00 sec)


mysql> CREATE FUNCTION sys_eval RETURNS string SONAME 'lib_mysqludf_sys.so';
Query OK, 0 rows affected (0.00 sec)


mysql> SELECT sys_exec('curl http://stackoverflow.com/');
+--------------------------------------------+
| sys_exec('curl http://stackoverflow.com/') |
+--------------------------------------------+
| 0 |
+--------------------------------------------+
1 row in set (0.12 sec)

[Updated on: Wed, 29 January 2020 15:21]

Report message to a moderator

Previous Topic: NodeMCU ESP8266 How To on Arduino IDE
Goto Forum:
  


Current Time: Fri Aug 07 18:01:17 EDT 2020

Total time taken to generate the page: 0.02708 seconds