Skip to Content
0
Former Member
Jan 10, 2008 at 03:17 PM

Any way to use OBDC in SAP to access MySQL DB and retrieve data

799 Views

I'd like to logon to an external MySQL DB (can de done easily enough with PHP) but I'd like to do it with ABAP if possible.

Connecting via OBDC I should be able to retreive the data from the DB and then use it in my SAP application.

Some databases will allow connection via


EXEC SQL.

 connect to :dbsid

  ENDEXEC.

EXEC SQL.
    set connection :dbsid
  ENDEXEC.

EXEC SQL.
  open xxxxxxx for
  select

...... data from external DB

from tablespace in external db

ENDEXEC.


do.

  EXEC SQL.
    fetch next XXXXXX into
           :db_table_field, .... etc
             ENDEXEC.
  if sy-subrc ne 0.
    exit.
  endif.
  insert table int_sap_table.
enddo.
EXEC SQL.
  close XXXXXX
ENDEXEC.

If you can make this type of stuff work for a MySQL DB i'd appreciate the answer.

Using PHP has a drawback as you need to have it installed on the front end PC and run in Foreground.

The EXEC SQL commands run in batch which is what you need if you are talking about 100,000's of records from an external DB.

Cheers

jimbo