Connection object from application module

hi
i was wondering if there is someway to retrieve the Connection object from the application module. something like:
java.sql.Connection conn = appMod.getConn();
i'm using JDeveloper 9.0.3.4
Thanks in advanced
Vitor

Take a look at
http://radio.weblogs.com/0118231/2004/01/30.html#a232
Sascha

Similar Messages

  • Obteain connection object from application module

    Hello
    I am working with ADF 10g using BC4j , I am in application module implementation class, how can I obtain the java.sql.connection object used by my application module?

    to execute prepared statements follow
    http://download-uk.oracle.com/docs/html/B25947_01/bcadvgen005.htm#sm0297
    to access the SQL connection itself (for whatever reason)
    Re: how to get connection from adf bc?
    Frank

  • BC4J: How get Connection from Application Module

    I've written a custom method for my Application Module for using by the client tier. In this method I call a JPUblisher created class, that accesses a PL/SQL procedure. For this JPublisher created class I need a connection context. The class calls DefaultContext.getDefaultContext() but that seems to be null.
    How can I get the current Connection of the Application Module, so that I can create a DefaultContext?
    Unfortunately Transaction has no getConnection method.
    Thanks,
    Robert

    We don't make the Connection directly available because in some sense it's a rope on which you can hang yourself if you are not careful. Since BC4J AppModules are most often used from a pool, and you might be using connection pooling in addition to application module pooling, in general it is not safe to get hold of the raw JDBC connection and "hang onto it".
    If you make careful use to always get the current JDBC connection before you use it, and not try to cache it, then you should be ok. Often, you can avoid the need to get the raw JDBC connection by calling getDBTransaction().createPreparedStatement(...) or the analogous createCallableStatement() or createStatement() that are also on the DBTransaction interface.
    Here is a little function you can add to your application module impl class to retrieve the Connection:
      private Connection getCurrentConnection() {
        Statement st = null;
        try {
          st = getDBTransaction().createStatement(0);
          return st.getConnection();
        catch (SQLException s) {
          s.printStackTrace();
          return null;
        finally {
          if (st != null) try { st.close(); } catch (SQLException s2) {}
      }It basically creates a (dummy) statement, gets the current connection from the statement, then closes the statement.
    I tried using this in a custom method in an AppModuleImpl class that invoked a JPublisher-create package-wrapper class like this:
      public void callStoredProc() {
        try {
          // Empservice is package wrapper class created by JPublisher
          Empservice e = new Empservice(getCurrentConnection());
          BigDecimal sal = e.lookupsalary(new BigDecimal(7369));
          System.out.println(sal);
        catch (SQLException s) {
          s.printStackTrace();
      }and it works for me.

  • Can I operate the view object outside application module?

    I publish a Application Module into Oracle 8i Server. When I operate the view object in a class that published in Oracle 8i Server.
    It raise a remoteException. Can I operate the view object outside application module?

    Hi,
    The application module is the main point of contact for the ViewObject and EntityObject classes. It handles things like the connection pooling and other coordination aspects.
    You need to go through the app module to access the ViewObject class methods.

  • PL/SQL from Application Module instead of Using VO/EO - Violating Standard?

    Hi,
    I have seen product code which Use PL/SQL APIs for committing data (Creation of Records in Table) from Application Module. There is no BC4J (VO/EO) used in this data route.
    Is there any coding standard (document) which says such cases are against Standards.I know there is one Standard saying PL/SQL Based VO is dicouraged in Oracle Apps.
    Thanks
    Joseph

    Vikram,
    Performance depends on the way you are going to make use of pl/sql code. Suppose if you are using pl/sql just for final insert/update with other validations bound to it through a single call, that's fine. But in case you have other multiple calls to pl/sql blocks also for fetching data for display purpose, that's where standard VO's will be more efficient reducing the number of trip for pl/sql calls. So use it only when it is the last way and you need to handle multiple validations with complex data structure.
    As for locking, yes, you might have to take care of locking handling scenario if such a situation happens. But again it depends on what's your business logic and how is your data being processed.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Sharing view objects across application modules

    Our application uses multiple application modules because of the complex functional requirements. We have come across sharing view objects among application modules. I want to understand the best practice, sharing view object instances across application modules. These view objects can be based on Entity Objects also.
    Please let me know if there any suggestions.
    Thanks,
    Satya

    Hi Satya,
    You won't be able to share view objects between application modules, but what you can do is to share the bind variables between application modules, if each of your module contains the 'common' view object.
    A solution for sharing data between application modules is provided on this blog: http://andrejusb.blogspot.co.uk/2012/05/solution-for-sharing-global-user-data.html
    You can use this approach to share bind variables between AM's and re-query the same data.
    Hope this helps,
    Florin Marcus
    www.redsamuraiconsulting.com

  • Call VO method from application module

    Hi Experts.
    In my case I have created VO and inside implementation class custom method: filterResultsByGroup()
    code:
    public class VO_Business_AreaImpl extends ViewObjectImpl implements VO_Business_Area {
    public VO_Business_AreaImpl() {
    public void filterResultsByGroup() {
    System.out.println("hello");
    now... I would like to call filterResultsByGroup() method from Application Module Imp class:
    code:
    public class AppModuleImpl extends ApplicationModuleImpl implements AppModule {
    public AppModuleImpl() {
    public VO_Business_AreaImpl getVO_Business_Area1() {
    return (VO_Business_AreaImpl)findViewObject("VO_Business_Area1");
    public void RunGroupFilter(){
    ViewObjectImpl bussinesArea;
    bussinesArea = this.getVO_Business_Area1();
    ViewCriteria vc = bussinesArea.getViewCriteria("filterResultsByGroup();");
    bussinesArea.applyViewCriteria(vc);
    bussinesArea.executeQuery();
    but it doesn't work. Anyone knows how to call this method?
    Best Regards.

    you code should be like
    VO_Business_AreaImpl bussinesArea;
    bussinesArea = this.getVO_Business_Area1();
    bussinesArea.filterResultsByGroup();

  • Calling stored procedures from entity object and application module

    Hello
    I've put in place an EntiyImpl base class containg helper methods to call stored procedures.
    I now need to call stored procedures from the application module.
    Apart from creating an application module base class and duplicating the helper method code is there a way
    to share the helper methods for calling stored procedures between the entity impl and application module impl ?
    Regards
    Paul

    Does the helper code depend on features of a particular entity object instance, beyond its database transaction?
    If so, I'm not sure I see how it could be used from an application module class.
    If not, here's what you do:
    Step 1:
    Parametrize the database transaction--you might even want to. So instead of
    protected myHelperMethod(Object someParam) {
    DBTransaction trans = getDBTransaction();
    change this to
    protected myHelperMethod(DBTransaction trans, Object someParam) {
    Step 2: make the method public and static--once you parameterize the DBTransaction, you should be able to do this.
    public static myHelperMethod(DBTransaction trans, Object someParam) {
    Step 3: Remove the method from your EntityImpl base class into a utility class:
    public abstract class PlSqlUtils {
    private PlSqlUtils() {}
    public static myHelperMethod(DBTransaction trans, Object someParam) {
    When you want to call the method from an application module, entity object, or even view object class, call
    PlSqlUtils.myHelperMethod(getDBTransaction(), paramValue);
    Unlike Transaction.executeCommand(), this lets you provide functionality like setting procedure parameter values, retrieving OUT parameter values, etc.
    Hope this helps,
    Avrom

  • How to get value in backing bean from application module

    Hi all.. I'm new in jdeveloper and adf..
    I need to use value from backing bean and use that value in application module.
    But I don't know how to get it.
    Do you a have any solution?

    suppose you have myMethod(String argumentName1,String argumentName2) in your Application Module
    then to access a method binding from a managed bean, use the following code,
      BindingContext bctx = BindingContext.getCurrent();
      BindingContainer bindings = bctx.getCurrentBindingsEntry();
      OperationBinding operationBinding =
           bindings.getOperationBinding("name_of_method_binding");
      //Here you can pass the parameters value to the AM method
      operationBinding.getParamsMap().put("argumentName1",value1);
      operationBinding.getParamsMap().put("argumentName2",value2);
      //invoke method
      operationBinding.execute();
      if (!operationBinding.getErrors().isEmpty()) {
         //check errors
         List errors = operationBinding.getErrors();
      //optional
      Object methodReturnValue = operationBinding.getResult();

  • Obtaining DataSource from Application Module

    How may i obtain DataSource from pool managed by Application Module? I want some of my db-related operation performed by Spring's JdbcOperations class ( http://www.springframework.org/docs/api/org/springframework/jdbc/core/JdbcOperations.html ) and i want have only one connection pool in my application.
    Thanks,
    Kind regards,
    Marcin Zduniak / http://J2ME.pl

    Refer
    http://www.oracle.com/technology/products/jdev/howtos/10g/usingdatasources/using_datasources.html

  • Error While Calling a WebService from Application Module

    Hi all
    I have generated a Proxy from a web Service and i am trying to call the web service from an Application Module it is throwing me error
    JBO-29000: Unexpected exception caught: oracle.classloader.util.AnnotatedNoClassDefFoundError, msg= Missing class: webservices.types.com.siebel.xml.order_interface.Orders Dependent class: java.lang.reflect.Array Loader: jre.bootstrap Code-Source: unknown Configuration: jre bootstrap
    Missing class: webservices.types.com.siebel.xml.order_interface.Orders Dependent class: java.lang.reflect.Array Loader: jre.bootstrap Code-Source: unknown Configuration: jre bootstrap
    IMy web Service is correct, as i have executed the client and it is working fine, but when i try to class the web service from an external class or from an application module it is throwing me this error. So any light on this issue will be very helpful
    thanks

    Hi,
    did you registered the web service in the external service registration? The "DataAccessException:" is a hint to this issue.
    best regards,
    Rene

  • Error while calling webservice from application module

    Hi all
    I have generated a Proxy from a web Service and i am trying to call the web service from an Application Module it is throwing me error
    JBO-29000: Unexpected exception caught: oracle.classloader.util.AnnotatedNoClassDefFoundError, msg= Missing class: webservices.types.com.siebel.xml.order_interface.Orders Dependent class: java.lang.reflect.Array Loader: jre.bootstrap Code-Source: unknown Configuration: jre bootstrap
    Missing class: webservices.types.com.siebel.xml.order_interface.Orders Dependent class: java.lang.reflect.Array Loader: jre.bootstrap Code-Source: unknown Configuration: jre bootstrap
    My web Service is correct, as i have executed the client and it is working fine, but when i try to access the web service from an application module it is throwing me this error. So any light on this issue will be very helpful
    thanks

    This forum is for XML DB issues. XML DB is a feature of 9iR2 and later.You need t look in the XML Technology forum

  • Creating logical/virtual connection object  from physical connection

    Can anybody help me what is creating logical/virtual connection object and how to create it from physical connection in java ??
    Thanks in advance...

    WHile you are waiting for an answer, you might want to review the related Oracle documentation:
    For 10g, all docco is at http://www.oracle.com/pls/db102/portal.portal_db?selected=3 and docco I suspect will help you is "Java Developer's Guide" and "JDBC Developer's Guide and Reference"

  • POJOs or EJBs for worker classes spawned from Application Module?

    Hello,
    I'm running JDev 11.1.2.3.0.
    I need to create a couple of worker classes that will be instantiated from my Application Module. The first will invoke PL/SQL via createCallableStatement. The second sends a message to a jabber server.
    In the Java EE world, I'd do this with stateless EJBs and use the @PreConstruct and @PostDestroy annotations to control the lifecycle.
    What is the recommended approach with ADF when using Classes to make these calls from an Application Module? Should one use POJOs and rely on WebLogic to handle garbage collection, or should/can one use EJB 3.0 stateless session beans?
    Many thanks.
    Edited by: user576183 on May 11, 2013 9:24 AM

    Stateless session beans is the recommended approach with ADF BC too.
    http://docs.oracle.com/cd/E14571_01/web.1111/b31974/bcextservices.htm
    http://technology.amis.nl/2013/01/20/adf-interaction-with-business-service-an-ongoing-discussion/

  • Connection Object from devices FM

    hi all,
    Is there any function Module that can be used to retrieve the connection object for a device.
    regds,
    stock

    Hi stock,
          Use ITOB_FUNCLOC_READ_SINGLE by inputing device in I_FUNC_LOCATION field. The resulting connection object will be in the export parameter E_OBJECT_REC. ie E_OBJECT_REC-TPLMA will be your connection object.
    Please reward points if useful.
    Regards,
    Harikrishna.

Maybe you are looking for