Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Update tables in Mysql from Oracle PLSQL

user3029023Nov 2 2010 — edited Nov 3 2010
Dear All,

We have some same tables in MYSQL and oracle database, as the requirements are to update tables in mysql once any change in oracle database tables.

Is there any way to update tables in MYSQL from oracle database through PLSQL. if Yes send me some references


Thank You

Comments

Toon Koppelaars
If your MySQL database is accessible through an ODBC-driver, then you could configure DG4ODBC, to provide you with transparent SQL access to that database using a regular database link.

However, I don't think that you'll be able to perform a distributed transaction (involving 2 phase-commit). So you'll have to commit the work in Oracle first, and then do a remote transaction via the db-link, and commit that too.

http://download.oracle.com/docs/cd/B28359_01/gateways.111/b31042/configodbc.htm
Billy Verreynne
We use UnixODBC and Oracle's Heterogeneous Database Services to create a database link from inside an Oracle database to a remote mySQL database.

Simple explanation of how it works:
A database session uses a database link to mySQL. The database link refers to a HS (Heterogeneous Service) supported by the local Oracle Listener. The Listener hands that connection off to a HS Agent. This Agent handles the database connection request, opens an ODBC connection to the foreign database server, execute the SQL (via ODBC), fetches the response and then returns it to the database session.

So what you need to do are:
- configure ODBC connectivity from your Oracle server to the mySQL server (create a DSN and test it using an ODBC client like isql)
- install and configure the HS Agent (which needs to use the ODBC libraries and the DSN)
- configure the Oracle Listener for supporting the HS Agent
- define the database link and test it

If you google this topic, you should find the relevant references to Oracle documentation and even blog entries with examples.
1 - 2
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Dec 1 2010
Added on Nov 2 2010
2 comments
1,072 views