2006 May 30 3:17 PM
Hi All,
Is it possible to access an ORACLE table and fetch data from using JDBC (Java DataBase Connectivity). If it is, could anyone tell me what command/function module etc to use in ABAP (sample code will be highly appreciated).
2006 May 30 3:26 PM
Hi,
You can try with EXEC and ENDEXEC to fetch the data using Native SQL.
DATA: BEGIN OF WA,
CLIENT(3), ARG1(3), ARG2(3),
END OF WA.
DATA F3(3).
F3 = ' 1 '.
EXEC SQL.
SELECT CLIENT, ARG1 INTO :WA FROM AVERI_CLNT
WHERE ARG2 = :F3
ENDEXEC.
WRITE: / WA-CLIENT, WA-ARG1.
Regards
vijay
Thanks Jesus. I will try and let you know how it goes.
2006 May 30 3:26 PM
Hi,
You can try with EXEC and ENDEXEC to fetch the data using Native SQL.
DATA: BEGIN OF WA,
CLIENT(3), ARG1(3), ARG2(3),
END OF WA.
DATA F3(3).
F3 = ' 1 '.
EXEC SQL.
SELECT CLIENT, ARG1 INTO :WA FROM AVERI_CLNT
WHERE ARG2 = :F3
ENDEXEC.
WRITE: / WA-CLIENT, WA-ARG1.
Regards
vijay
2006 May 30 3:33 PM
hi Sandip,
Use Commands <b>EXEC</b> and <b>ENDEXEC</b>
Check this out
http://www.sapdevelopment.co.uk/java/jco/bapi_jco.pdf
Hope it helps,
Regards,
Santosh
2006 May 30 4:13 PM
Thanks for both of your answers. But actually the question I asked is how to establish the connection (the table is sitting outside SAP). My understaning is to access the table, we have to establish a connection (probably JDBC) between SAP and the table. Otherwise how will the native SQL EXEC-ENDEXEC work for that table?
2006 May 30 7:26 PM
2006 May 30 8:19 PM
2006 May 30 8:28 PM
Hi,
I would start looking at the SAP JCo connector for this.
With this, you can design/develop a interface program.
You can check the SAP services, for more details on this connector.
Regards,
Sumant.
2006 May 30 8:30 PM
Thanks Sumant. Can you suggest me where should I start looking at for SAP Services?
2006 May 30 9:42 PM
Hi Sandip. To connect to a secondary database, you use the EXEC SQL command. You first must configure a database connection on DBCO transaction. There you specify the ODBC for the connection, you could use Oracle, MSSQL, DB2, etc; you also specify the server name, user and password... Then, on your program you use:
EXEC SQL
CONNECT dbcon
ENDEXEC
EXEC SQL
OPEN CURSOR dbcur FOR
SELECT * FROM table
ENDEXEC
EXEC SQL
DISCONNECT dbcon
ENDEXEC
That's a very simple example. Check out the help on these sentence.
Hope it Helps.
Jesus
2006 May 30 9:51 PM
Jesus,
Thanks a lot. Let me try this tomorrow. I might come back with some more questions.
One for the moment. While configuring the database connection in DBCO, what does the entry in the field 'Conn. info' look like?
2006 May 30 10:03 PM
Hi Sandip. I've use DBCO to connect to an MSSQL Server DB, however in Conn.info you should put the values to connect to the oracle database. You may wanna check the note 339092:
Connection name: logical name of the connection
DBMS: ORA
User name: Oracle users
DB password: password for the above-mentioned
Oracle user
Conn.info: TNS alias
Permanent: Usually should not be set for a secondary connection.
Hope it Helps.
Jesus
2006 May 30 10:10 PM
2006 Jun 07 4:43 PM
Hi Sandip,
Here are some links related to SAP JCo:
<a href="http://www.sapgenie.com/faq/jco.htm">http://www.sapgenie.com/faq/jco.htm</a>
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/6f/1bd5c6a85b11d6b28500508b5d5211/content.htm">http://help.sap.com/saphelp_nw04/helpdata/en/6f/1bd5c6a85b11d6b28500508b5d5211/content.htm</a>
Hope this helps.
Regards,
Sumant.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |