Configure Destination

In this section we will define Generic JDBC Adapter for MySQL replication, the steps are similar as the previous:

JDBC Drivers

MySQL

Properties File

Golden Gate (replicat)

So, let's get going.

Configure JDBC Drivers

Configure JDBC Driver

Configure MySQL

Configure my.cnf (e.g. /etc/my.cnf)

We can start mysql and configure MySQL for the replication

Start & Verify MySQL

Configure Properties File

Configure Properties File(e.g. TRG_OGGHOME/dirprm/jdbc_mysql.properties

Configure Golden Gate (replicat)

Configure Golden Gate

Verify

To verify the repplication configuration, we will again insert data and check if that data is replicated

Insert Data into Oracle

Now, we can verify if the Golden Gate Replication Worked

Golden Gate Replication

Finally, we can check if the data is replicated on the MySQL

Verify MySQL

Replication with Different Table Structure

What if we want to replicate between two tables which have different structure:

Table Differences

In our case the product_id and product_code on the source are different than the prod_name and prod_code on the destination, therefore if we try to add data on the source:

Try to add data on Prod

The Golden Gate Replication Replicat will ABEND:

Golden Gate Replicat (Abend)

So in order to fix that we have to do 2 things:

Fix the jdbc properties file, to allow mapping of column with different names

Map these columns in the rjdbc parameter file

So let's do it:

Modify JDBC Properties File

Make sure to add the following parameters, to the existing configuration.

Modify JDBC Properties File

Modify Replicat Param File

Now we can modify the RJDBC param file:

Modify Replicat param file

Verify the Replication

Now, we can start the RJDBC and verify if the rows were replicated:

Verify the Replication

We see that 99 inserts were processed, we can check of course also the MySQL database:

Verify MySQL Replication