Skip to Content
author's profile photo Former Member
Former Member

How to connect to DB2 from ABAP program

Hi,

In my ABAP program I need to retrieve 3 fields from one table of DB2 database. I have tried creating an RFC connection in SM59 and then using native SQL in abap code but could not succeed.

I have also maintained an entry in DBCON table but am unable to connect through program.

Pls suggest.

Thanx in advance.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Oct 11, 2005 at 03:20 PM

    I have tried this in the past, I wanted to access data from an external SQL database on another machine. I couldn't get it to work, and someone told me that I need to have a "Windows" application server in order for it to work. Since we run on AS400, i never got it working.

    Regards,

    Rich Heilman

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 11, 2005 at 03:24 PM

    Hi,

    Thanx for your prompt response. Our R3 is running on Oracle. I think 'connect' syntax should work but I am not sure where the error is.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 11, 2005 at 03:40 PM

    Preeti-

    DBCON may not work for you because your target is DB2. You SAP system should have the suitable driver files for connecting to DB2 and I don't think currently this is supported.

    However, there are other ways of doing it. One ofcourse is to use a middleware tool, which I guess you don't have in your landscape.

    If investing on a middleware tool is out of scope, here are other options

    1) If you are a microsoft shop, use .NET connector (freely downlaodable from SAP service market place). You can develop a .NET component which will use .NET connector for connecting to SAP and OBDC to connect to your AS400 system. The OBDC drivers can be obtained from IBM.

    2) If you are a java shop, you can develop a java code which can run on your AS400 system or a separte server (windows,unix..).

    This java code will use JRFC/JCO (again downloadable for free from SAP service market place) to connect to SAP while it will use Client access ODBC drivers or JT400 drivers (google JT400) to connect to your DB2 database.

    Though developing this is not a great deal, could be bit challenging if done for the first time. Let me know which way you wanna go and I can guide with more information/code samples.

    KK

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.