You want to use the RPG2SQL with a MySQL database. 


  1. Install the MySQL database server from the MySQL web site:
  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.

    For example: To configure an ODBC database driver connection called MySQL1 that points to a MySQL database named test on the current PC localhost, use the following settings:

    Note: The MySQL database server could actually be running on any platform such as Linux, Unix, and so on, as long as you enter the correct IP address in the MySQL ODBC driver settings.

  4. After you have configured the MySQL ODBC data source, use the following data source syntax in your ILE RPG program to connect to the MySQL ODBC driver.

    Note: The connection string in this example 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. Use the following RPG SQL statement to select all records from the NameAddress table 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')      

Contact Fortra if you need additional assistance with MySQL databases. 

Still have questions? We can help. Submit a case to technical support

Last Modified On:
You don't have the appropriate permissions.
No, open a new Support Case