Skip to Content
author's profile photo
Former Member

Connection to Databases

In which way can I connect a Database from an WebDynPro - Project? Is there any technology like binding to a RFC - BAPI ? I cnan't find any tutorial here.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • May 25, 2004 at 03:39 PM

    Hi Christof,

    I would suggest to write an EJB (e.g. stateless session bean) and generate a Web Service for this.

    Then you can use this Web Service to generate a Web Dynpro model.

    An example is enclosed in the "car rental tutorial".

    Another way to get data from a database is using JDO. There is also a tutorial or description available for this (search the SDN).

    You can of course connect to a database from a component or view controller via JDBC or SQLJ but you shouldn´t use this approach because then there is no separation of presentation layer and business logic layer.

    Regards

    Helmut

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    May 30, 2004 at 08:34 AM

    Hi,*

    I was very glad to see this discussion, I think this is a really important point of the WD technology.

    Never the less I have a little bit different point of view on this issue. You are talking about EJB as a beans to distribute some common application logic over differnt application, but it seems to me that SAP wants you to use WD components instead. This is a reason, I think, for such a tight coupling among model and component, the model is not redistributable but the component which envelope the model (Adaptive RFC model) is. So just instead of enveloping logic in EJB, envelope it in WD component and use from others. That's the way I think they want us to work and in general I have no reason to go back to EJB and to work hard , doing Jco stuff myself.

    P.S. do you know the reason for removing the EJB kind of model form SP5?

    Best regards,

    Victor

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Victor,

      i'm glad to see more interested people participating in this discussion.

      But using the (really great) Web Dynpro component model is not the solution here.

      Web Dynpro is very well suitable to manage the presentation layer of a business application, but, especially in conjunction with Dynamic RFC models usage, starts handling of security and transaction management issues, which should <b>not at all</b> be part of this layer.

      You as the presentation logic developer must decide, when to call BAPI_TRANSACTION_COMMIT for example!! Do you know all other DRFC model users and the changes, they might already have done before you are "called" in any possible combination with the component you're currently implementing?

      I don't think so and the fact is, you <b>shouldn't have to</b> think about this, because that's exactly what is handled by the transaction management of the J2EE engine normally (at least in case of container managed demarcation).

      And of course you don't want to do those nasty JCo stuff by yourself inside the EJB. But you won't have to do so, since you even won't know, that you are using a SAP system as the EIS, which provides the business logic.

      Best regards

      Stefan

  • author's profile photo
    Former Member
    Jun 15, 2004 at 10:52 PM

    I am unable to get this working inside my WD Application. I'm calling the server like so:

    InitialContext ctx = new InitialContext();

    DataSource ds = (DataSource)ctx.lookup("jdbc/SRVERNAME");

    where SRVERNAME is the ds name in before mentioned virtual admin location. I receive the Object Not Found in lookup of SRVERNAME.

    The code is currently located in a method added to one of my views. Any suggestions?

    Regards

    Add comment
    10|10000 characters needed characters exceeded