Using RPG2SQL Integrator with MySQL ODBC Driver
From Support
| | If you have a question or seek clarification, please call Technical Support. |
Problem:
You want to use the RPG2SQL Integrator with a MySQL database.
Solution:
1.) Install the MySQL database server from the MySQL web site: http://www.mysql.com
2.) Install the MySQL ODBC driver on a PC running the RJS RPG2SQL PC Server component. The MySQL ODBC driver can be downloaded from the MySQL web site.
3.) Run the ODBC administrator (ODBCAD32.EXE) to create an ODBC data source that points to your MySQL database server.
The example listed below configures an ODBC database driver connection called: MySQL1 that points to a MySQL database named: test on the current PC: localhost
Note: The MySQL database server could actually be running on any platform such as Linux, Unix, etc. as long as the correct IP address is entered into the MySQL ODBC driver settings.
4.) After the MySQL ODBC data source has been configured, use the following data source syntax in your ILE RPG program to connect to the MySQL ODBC driver created in the previous steps. The connection string used in this sample uses the root MySQL user ID with no password.
C* ** Open ADO SQL Database Connection via MySQL ODBC Driver C Eval Rtn = SQL_DBOpenConn(SQL_Socket: C 'DSN=MYSQL1;' + C 'Uid=root;' + C 'Pwd=;')
5.) The following RPG SQL statement selects all records from the NameAddress table we created in the MySQL Database: test
C* ** Run Query to Open ADO Recordset from MySQL database C Eval Rtn = SQL_RunSQLSel(SQL_Socket: C 'SELECT * FROM test.NameAddress')
Please contact RJS if you need additional assistance with MySQL databases.


