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

making database connection

Hi,

Can anyone tell me how to make database(sap r/3) connection from a webdynpro application.

it would be of great help if you send me a sample example also.

Regards,

Rashmi.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 25, 2005 at 04:47 AM

    Hi Rashmi,

    If you were able to solve the problem and if you got the solution then please close this thread.

    Regards,

    Bhavik

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 19, 2005 at 06:54 AM

    Hi Rashmi,

    There is an example tutorial which shows you how to design, implement, deploy, and run a basic Web Dynpro application that accesses persistent data from a remote SAP system.

    Please check the link below :

    http://help.sap.com/saphelp_nw04/helpdata/en/c3/76b45d9688e04abe1a1070410ddc1e/content.htm

    Regards,

    Vijith

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 19, 2005 at 06:55 AM

    Hi Rashmi,

    You can not connect to the SAP R/3 database. But you can create one custom function module and enable it as RFC eanbled. Write code for fetching data from database in this function module.

    Then, cretae one RFC model in webdynpro application and there you can call this Function module.

    you cna look at the tutorial for this in below link:

    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/web dynpro sample applications and tutorials.htm#program

    Regards,

    Bhavik

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 20, 2005 at 04:11 AM

    Hi Rashmi,

    Not sure whether your problem is solved.

    Try some thing which is simple like this in your connection method of your Web Dynpro.

    try

    {

    // Load the jdbc-odbc driver

    Class.forName("oracle.jdbc.driver.OracleDriver");

    // Open a connection to the odbc data source entered by the user

    Connection connect =DriverManager.getConnection("jdbc:oracle:thin:@10.201.103.78:1521:HCM" ,"<userid>","<passwd>");

    System.out.println("Connection Established --->"+connect);

    Statement stmt = connect.createStatement();

    //Sample Query--->Replace your query here

    ResultSet rst = stmt.executeQuery("select text from category where category_id='Index100'");

    //Iterate thro' your resultset like this

    while(rst.next())

    {

    resultString = rst.getString("text");

    }

    //Close your Resultset

    rst.close();

    }

    // If not connected to DB catch your exception to know what was the problem is

    catch(Exception e)

    {

    e.toString();

    System.out.println(e.toString());

    }

    // Close your connection in Finally Block

    finally(){

    if(connect==null)

    {

    connect.close();

    }

    }

    Not but not the least copy your DB drivers file in your lib folder of your project structure which sets the classpath to get connected to DB.

    Hope it is simple and will help you.

    Regards,

    Guru

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 25, 2005 at 08:58 AM

    Hi Rashmi

    you can use RFC's for connecting with R/3 system

    you can get through tha example given in following link

    http://help.sap.com/saphelp_nw04/helpdata/en/16/36d93f130f9115e10000000a155106/frameset.htm

    by the topic 'web dynpro app. accessing abap functon'

    you need further help you can post msg

    this whole example is using bapi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 25, 2005 at 09:01 AM

    Hi all,

    Thanks for the info.

    Regards,

    Rashmi.

    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.