Skip to Content

How to get data from an Oracle DB

Hi guys.

I need to connect to an Oracle DB to get data from it.

I read a lot of forums, but I'm not able to create a DBCO connection and I'm stuck on it.

1) how do i create the connection to Oracle?

the data of the Oracle server is:

192.168.xxx.xxx (name SRVLIM**)

data base name on Oracle = SM92

user: li***

password = li**

2) once i have created the connection, what do i have to do in ABAP code to get the data??

Please some helps.

Regards

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Dec 01, 2010 at 04:24 AM

    What are you trying to achieve?Are you writing a piece of code where you want to connect to the DB using abap code ?

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 01, 2010 at 06:27 AM

    Did you check R3trans with the option to export data from specified database tables?

    Create a control file:

    export
    client = <CLNT>
    file = <path/exportfile>
    select * from <TABLE>

    Then execute R3trans with the given control file to export data from the DB:

    R3trans -w <Log-File> <path/controlfile>	

    Hope this helps.

    Kind regards,

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 01, 2010 at 01:17 PM

    Hi guys.

    I was able to create the connection from SAP to Oracle DB using DBCO. I tested it using the program (se38) ADBC_TEST_CONNECTION and it works well.

    Now I'm coding a program to get data from that DB in Orackle. I was able to get all the data, but i need to get some especific data from a date > '01-09-2010'

    The problem is that i'm getting a DUMP. I guess is because the where sentence is wrong.

    What am I doing wrong?

    Check my code:

    DATA: BEGIN OF datos OCCURS 0,
          id_numeric(10),
          END OF datos.
    DATA: c TYPE cursor.
    
    
    EXEC SQL.
      connect to 'LIM' as 'MYDB'
    ENDEXEC.
    
    * Open connection
    EXEC SQL.
      SET CONNECTION 'MYDB'
    ENDEXEC.
    
    EXEC SQL performing loop_output.
    SELECT ID_NUMERIC into :datos from lims.SAMP_TEST_RESULT
    where SAMPLED_DATE = '2010-09-01'
    
    ENDEXEC.
    
    EXEC SQL.
      disconnect 'MYDB'
    ENDEXEC.
    
    FORM loop_output.
      WRITE: / datos-ID_NUMERIC.
    ENDFORM.
    

    if i comment the where sentence, it works well, but i need to use it. What I am doing wrong??

    Help

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 02, 2010 at 01:08 PM

    ...

    Add comment
    10|10000 characters needed characters exceeded