cancel
Showing results for 
Search instead for 
Did you mean: 

How to get data from an Oracle DB

former_member203305
Active Contributor
0 Kudos

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

Accepted Solutions (0)

Answers (4)

Answers (4)

former_member203305
Active Contributor
0 Kudos

...

former_member203305
Active Contributor
0 Kudos

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

former_member204746
Active Contributor
0 Kudos

Dates must be handled differently. the SAP format does not match the Oracle Format.

I suggest to post this in another forum as this is not a BASIS issue at this point.

former_member203305
Active Contributor
0 Kudos

I guess that the forum is correct.it is called, SAP on Oracle.

So as I need to get the data from Oracle using abap. it is ok.

Regards

former_member204746
Active Contributor
0 Kudos

This forum is to manage Oracle on SAP, not to program things into Oracle.

Former Member
0 Kudos

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,

Former Member
0 Kudos

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