4D for MySQL plugin allows the user to access the data and structure of a MySQL database without any pre-created ODBC data source. 4D for MySQL supports MySQL versions 3.23.XX - 4.0.X. The example below demonstrates how to connect to a MySQL database and insert data into a table using 4D for MySQL plugin.
`Method inserting data in MySQL using 4D for MySQL Plugin
C_LONGINT($connectionid)
`Establishes a connection for MySQL
$connectionid:=MySQL_Connect ("Server address";"Database name";"User name";"Password")
If ($connectionid#0)
`Executes a MySQL insert statement to insert data into the database
MySQL_Execute ($connectionid;"Insert into tablename (field1,field2) values ('field1value','field2value')")
`Closes the connection
MySQL_Close ($connectionid)
Else
ALERT("Connection Failed !")
End if