How to use a JCO connection pool in an EJB?

Hi *,
I want to build a WebService using SAP Web AS (J2EE Engine) that connects to a R/3 ERP (release 4.7).
I thought of building a stateless session bean that will be deployed as webservice. The session bean shall connect to the R/3 in order to call some BAPIs. I'd like to use a JCO connection pool. But I'm not sure, where I should create and destroy the connection pool. Are the EJB methods ejbCreate() and ejbRemove() the right ones? If so, my businness methods would just have to get a connection from the pool and call the BAPIs, right? If not, what do you suggest?
Another question: I already deployed a bean as webservice. Since not really knowing how to use the connection pool, I created a bean with one business method that creates a connection pool whenever it gets called. But if I have to change something in the bean so that I have to redeploy the bean I can't call my business method anymore, because JCO cannot load a native library once again, as it is already loaded, This leads to an exception. So I have to restart the complete engine everytime I redeploy my bean. Are there any workarounds for this problem? I'm not sure whether this is connected to the wrong use of the JCO connection pool.
Kind regards,
Lars

Hi *,
I want to build a WebService using SAP Web AS (J2EE Engine) that connects to a R/3 ERP (release 4.7).
I thought of building a stateless session bean that will be deployed as webservice. The session bean shall connect to the R/3 in order to call some BAPIs. I'd like to use a JCO connection pool. But I'm not sure, where I should create and destroy the connection pool. Are the EJB methods ejbCreate() and ejbRemove() the right ones? If so, my businness methods would just have to get a connection from the pool and call the BAPIs, right? If not, what do you suggest?
Another question: I already deployed a bean as webservice. Since not really knowing how to use the connection pool, I created a bean with one business method that creates a connection pool whenever it gets called. But if I have to change something in the bean so that I have to redeploy the bean I can't call my business method anymore, because JCO cannot load a native library once again, as it is already loaded, This leads to an exception. So I have to restart the complete engine everytime I redeploy my bean. Are there any workarounds for this problem? I'm not sure whether this is connected to the wrong use of the JCO connection pool.
Kind regards,
Lars

Similar Messages

  • JCO Connection pooling

    hi,
    <b>How to create connection pooling in WAS for SAP R/3 System.</b>
    I have  written session bean for Creating SalesOrder in SAP Using JCO.
    my application will create 100 connection objects if 100  Client Calls for my SessionBean  .so that i need to avoid creation of connection objects  for <i><b>every time</b></i>.
    pls tell me how configure WAS for JCO connection pooling .and How to get those connection objects. and how to use that connction object in my application.
    regards
    Guru

    Hi
    See this help
    http://help.sap.com/saphelp_nw2004s/helpdata/en/83/85343e8c7f6329e10000000a114084/frameset.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/6a/82343ecc7f892ee10000000a114084/frameset.htm
    Kind Regards
    Mukesh

  • Difference between using app server connection pooling and using the driver

    Hi all,
    How to get connection pooling with out application server and tomcat also?
    What is the difference between using app server connection pooling and using the driver supported connection pooling?
    Regards,
    Murali

    maybe the performance of App server pool is better than the JDBC pool,
    for you don't know wether the implementation of the JDBC interface is good or bad.

  • Retrieving System Name used in JCO connection ?

    Hi All,
    Do you know how to retrive the System Name paramer value used in JCO connection using Web Dynpro programe. If so can you please sen me how.
    I promise to award points for the correct answer.
    Thank you and Regards
    Maruti CR

    Hi Jennifer,
    Thank you for your reply. I am still trying to get the SAP system name for the model used. I trind to your your code but I am getting some compilation errors.
    Bapi_User_Get_Detail_Input iasmodel  = new Bapi_User_Get_Detail_Input();
    The code I used is
    Bapi_User_Get_Detail_Input iasmodel = (Bapi_User_Get_Detail_Input)WDModelFactory.getModelInstance(Bapi_User_Get_Detail_Input.class);
    IWDJCOClientConnection jcoClientConn = (IWDJCOClientConnection)iasmodel.modelInstance();
    I am getting compile errors..
    The type of model represented by class 'com.ias.Bapi_User_Get_Detail_Input' is not compatible for creation by WDModelFactory
    Can you please suggest?
    Thank you and Regards
    Maruti CR

  • How can I switch the connection pool dynamically during on load happens

    HI,
    I have two data bases which holds same data. i.e Prod_db, Prod_db1,
    I want to switch the connection pool dynamically during load happens
    Ex: During load happens i want to hit prod_db1, after load completes i want to hit prod_db. How to achieve this.

    create dynamic repository variable for DSN using init block so that value is changes based on your timings and use this in connection pool.
    If you use same user and passwords for both the databases that would be easy or else need to follow the same for uid and pwd.
    That should work, if not update.
    If helps pls mark correct/helpful

  • Web dynpro console - monitor - JCO Connection pools

    If you go to the web dynpro console -> monitor -> JCO connection pools you see a table with information.
    JCo Clients MonitorJCO Pools - 12:31:02.992
      Name Size Currently used Maximum used Max.connections Max.pool size
    Can somebody explain what for example the "Size" and "Maximum used" mean in this table?
    And if you have set max.pool size to 20, what things can override this setting in the SAP system?

    Hi,
    You can follow this link for information on JCO in Web Dynpro Java:
    [http://help.sap.com/SAPHELP_NW04S/helpdata/EN/3a/3b1b40fcdd8f5ce10000000a155106/frameset.htm|http://help.sap.com/SAPHELP_NW04S/helpdata/EN/3a/3b1b40fcdd8f5ce10000000a155106/frameset.htm]
    -Kunal Kotak

  • Using Database Resident Connection Pooling

    Hi all,
    <br><br>
    In trying to use Database Resident Connection Pooling in Oracle 11g, here is what I have done:
    <br><br>
    SQL> conn / as sysdba
    Connected.
    SQL> exec DBMS_CONNECTION_POOL.START_POOL();
    PL/SQL procedure successfully completed.
    SQL> SELECT STATUS,MINSIZE,MAXSIZE,INCRSIZE,SESSION_CACHED_CURSORS,INACTIVITY_TI
    MEOUT
      2  FROM DBA_CPOOL_INFO;
    STATUS              MINSIZE    MAXSIZE   INCRSIZE SESSION_CACHED_CURSORS
    INACTIVITY_TIMEOUT
    ACTIVE                    4         40          2                     20
                   300<br>
    <br>
    In tnsnames.ora file, here is what I have put:<br>
    ORA11G =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = winxp)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = ora11g)
    ORA11GP =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = winxp)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = POOLED)
          (SERVICE_NAME = ora11g)
      )<br>
    <br>
    Now, in sqlplus in attempt to use DRCP, here is what I got:<br>
    SQL> CONN HR/HR@ORA11G
    Connected.
    SQL> CONN HR/HR@ORA11GP
    ERROR:
    ORA-28547: connection to server failed, probable Oracle Net admin error
    Warning: You are no longer connected to ORACLE.<br>
    <b>Is there anything I missed to properly use DRCP.</b>
    <br>
    Thanks in advance.

    According to Metalink note:
    Subject: Using DRCP and NTS Authentication Results in ORA-28547
    Doc ID: Note:563943.1 Type: PROBLEM
    Last Revision Date: 19-MAY-2008 Status: MODERATED
    this is a bug on Windows and you should configure client sqlnet.ora so that SQLNET.AUTHENTICATION_SERVICES=NONE.

  • How to Know the How many number of JCo connections established?

    Hi
    How to Know the How many number of JCo connections established for mapping?

    Hi
    mConnection =  JCO.createClient("001", // SAP client
                  "<userid>", // userid
                  "****", // password
                  null, // language
                  "<hostname>", // application server host name
                  "00"); // system number
    //Connections to a specific application server (as in the above example)
    mConnection.connect();
    //Creating the JCO.Client object does not connect to SAP, but a subsequent call to
    connect() will accomplishes this
    So you can easily find out the number of JCo connections by checking out these.
    Thanks

  • How to used the internet connection adsl on my com...

    how to used the internet connection adsl on my computer by nokia n73 me
    i whant used the adsl connection in nokia n73 me by Bluetooth or cable
    and thank you

    Hi Theo,
    There are several ways to implement this using simple timing features of LabVIEW.  Two fairly simple methods are comparing system time stamps or using the Wait VI provided in the Timing palette.  The time stamp comparison requires a little bit more programming, but can be included in your main program loop.  To use the Wait function, you will probably need to construct a new loop parallel to your main loop.  I have attached screenshots of these two implementations.  Please let me know if you have any more questions.
    Donovan
    Attachments:
    WaitDelay[1].Png ‏5 KB
    TimeStampFalse.Png ‏11 KB
    TimeStampTrue.Png ‏11 KB

  • HT201205 how to use bluetooth to connect iphone to ipad???

    how to use bluetooth to connect iphone to ipad???

    what you do you expect them to be able to do with eachother ?
    you can transfer files or data between them unless you find some 3th party program which does that
    this is what ios devices support in terms of bluetooth profiles
    http://support.apple.com/kb/ht3647
    this is the full list of all bluetooth profiles (even your computer only support a fragtion of the list)
    http://en.wikipedia.org/wiki/Bluetooth

  • How can i know the no .of  connections are used in the connection pool

    Hi
    I am using tomcat connection pool in my project .but how can i know how many connections are used by my project .how can i know how many connections are used plez help me

    You mean INSIDE the webapp, using the Admin Console (tomcat docs should be helpful in that case)... Where are you supposed to search for the info?

  • JCO connection pool is exhausted

    hi
    I am using RFC module in my web dynpro application. When the application is used for sometime, the JCO connection will get exhusted. The JCO connection will not release itself. I can't find any method in web dynpro to release the connection manually. How can I solve this problem?

    Hi,
    What is scope of the connection. View properties of MODELDATA and METADATA  destinations.
    You can change the scope of the connection..
    or
    wdContext.current<BAPI INPUT>Element().modelObject().modelInstance().disconnectIfAlive();
    For more ways , give a forum search.. There are a lot of close forum posts.. Gud luc..
    Regards
    Bharathwaj

  • Problem with JCo Connection Pool

    Hi,
    I have a problem with using an RFC Model in my WebApplication. So sometimes the access to the function block works, and sometimes it doesn't work. Now I know, that there is a problem with the connection pool. Look at this message:
    com.sap.mw.jco.JCO$Exception: (106) JCO_ERROR_RESOURCE: Connection pool WD_X24_MODELDATA_DEST_CPIC_REKTO_DE_useDefinedUser is exhausted. The current pool size limit (max connections) is 10 connections.
    So it looks like a problem with closing the JCo Connections after using. Do know where the problem is? Because I'm using many other function blocks with no problems.

    Hello,
    You need to increase the pool size via Visual Administrator.
    Server 0 -> Services -> JCO RFC Connections.
    Change the pool size from there. I believe a restart is in order.
    Regards,
    Jan

  • Some doubts in using resource-ref,connection pool n Data-source

    Hi all ,
    I need little bit clarification in the following points.
    1) Does the connection pool which is created can be displayed in JNDI Tree???
    I am seeing only DataSOurce in the JNDI Tree Only.
    2)In case of Bean Managed Persistance, in ejb-jar.xml,
    I had given the following info.
    <resource-ref>
             <res-ref-name>ramukkDataSource</res-ref-name>
             <res-type>javax.sql.DataSource</res-type>
             <res-auth>Container</res-auth>
         </resource-ref>Does the <res-ref-name> refers to Datasource Name??
    In weblogic-ejb-jar.xml
    <reference-descriptor>
           <resource-description>
              <res-ref-name>ramukkDataSource</res-ref-name>
              <jndi-name>ramukkpool</jndi-name>
           </resource-description>
         </reference-descriptor>Here <jndi-name> refers to connection pool as per weblogic bible book.
    If so when i deployed my ejb into the server iam getting Datasource cant be found.
    If i had given like the following,
    In ejb-jar.xml
    <resource-ref>
              <res-ref-name>jdbc/ramuJndi</res-ref-name>
              <res-type>javax.sql.DataSource</res-type>
              <res-auth>Container</res-auth>
         </resource-ref> In weblogic-ejb-jar.xml
         <reference-descriptor>
              <resource-description>
               <res-ref-name>jdbc/ramuJndi</res-ref-name>
               <jndi-name>jdbc/ramuJndi</jndi-name>
           </resource-description>
        </reference-descriptor>Then only my ejb code is successfully deploying doing some work which is as per xpectation.
    Can any body tell why I have to give the same name for <res-ref-name> n <jndi-name>??
    I am working on this problem from last one week. Still not found the solution.
    Connection Pool Creation
    GENERAL::
    Name : ramukkpool
    url : jdbc:mysql://localhost:3306/test
    Driver Classname: com.mysql.jdbc.Driver
    Properties :
    user = root
    Password = XXX
    create
    TARGETS::
    i had shifted myServer from left side to right side n clicked >>Apply
    (Techncially can we say this as deploying the connection pool into server ???????????
    If not how to deploy the connection pool into server??)
    I did not get any errors in the console.
    Now i am creating a datasource
    CONFIGURATION:
    Name : ramukkDataSource
    JNDIName: jdbc/ramuJndi(Does we have to follow this convention only?? i.e JNDIName should start with jdbc/ only)
    PoolName: ramukkpool
    create
    TARGETS::
    I had shifed myServer from left to right n >>Apply.
    Now also i did not get any errors in the console.Thanx(in advance),
    ramu

    I have read the documentation.
    I changed my class to oracle.jdbc.pool.OracleConnectionCacheImpl from
    oracle.jdbc.pool.OracleConnectionPoolDataSource
    I observed in the EM that the Open JDBC Connections and Total JDBC Connections are the same. When I used oracle.jdbc.pool.OracleConnectionPoolDataSource my Total JDBC Connections was increasing and Open JDBC Connections remains 0.
    My question still remains unanswered, could some kindly help.
    Q? I have defined a data source in JDeveloper using
    oracle.jdbc.pool.OracleConnectionCacheImpl
    In my java bean I am using the code pasted below to make a connection to database.
    Can some one tell whether I am using the correct method of connection pooling mechanism or do I need to make some changes? This application uses JSP and used by lots of people which hits database very frequently.
    Any help is highly appreciable.
    Thanks in advance.
    *******Code to make connection*********
    private javax.naming.InitialContext context = null;
    private javax.sql.DataSource jdbcURL = null;
    private static final String url = "jdbc/ProdCoreDS";
    public boolean openConnection()
    try
        DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    context = new javax.naming.InitialContext();
    jdbcURL = (javax.sql.DataSource)context.lookup(url);
    con =  jdbcURL.getConnection();
    return true;
      catch(Exception e)
           System.out.println("Error in the Connection  "+e);
        e.printStackTrace();
                 return false;
         }}

  • What about session memory when using BEA Weblogic connection pooling?

    Hi,
    consider a web application, allowing database connections via a BEA Weblogic 8.1 application server. The app-server is pooling the oracle connections. The oracle database is running in dedicated server mode.
    How are the database requests from the web app served by the connection pool from BEA?
    1) Does one oracle session serve more than one request simultanously?
    2) Does BEA serialize the requests, which means, that a session from the pool is always serving only one request at a time?
    If (1) is true, than what about the session memory of Oracle sessions? I understand, that things like package global variables are beeing stored in this session private memory. If (1) is true, the PL/SQL programmer has the same situation, as with programming an Oracle databas in "shared server" mode, that is, he should not use package global variables etc.
    Thankful for any ideas...
    Message was edited by:
    Xenofon

    Xenofon Grigoriadis wrote:
    Hi,
    consider a web application, using BEA between client and an Oracle Database (v9i). BEA is pooling the oracle connections. The oracle database is running in dedicated server mode.
    How are the database requests from the web app beeing served by the connection pool from BEA?
    1) Does one oracle session serve more than one request simultanously?no.
    2) Or does BEA serialize the requests, which means, that a session from the pool is always serving only one request at a time?
    Reading "Configuring and Using WebLogic JDBC" from weblogic8.1 documentation, I read:
    "... Your application "borrows" a connection from the pool, uses it, then returns it to the pool by closing it...."
    What do you mean by returning the connection by closing it? Tbe server will either return the connection to the pool or close it...When application code does typical jdbc code, it obtains
    a connection via a WebLogic DataSource, which reserves an
    unused pooled connection and passes it (transparently wrapped)
    to the application. The application uses it, and then closes
    it. WebLogic intercepts the close() call via the wrapper, and
    puts the DBMS connection back into the WebLogic pool.
    The reason, why I as an Oracle programmer ask this is, because every session (=connection)
    in Oracle has its own dedicate, private memory for things like global PL/SQL variables.
    Now I want to figure out, if you have to careful in programming your databases, when
    one Oracle session (=connection) is serving many weblogic requests.It is serving many requests, but always serially. Do note however, that we
    also transparently cache/pool prepared and callable statements with the
    connection so repeat uses of the connection will be able to get already-made
    statements when they call prepareStatement() and prepareCall(). These
    long-lived statements will each require a DBMS-side cursor.
    >
    Thankful for any ideas or practical experience...
    Message was edited by:
    mk637Joe

Maybe you are looking for