Can I call an object with synchronized methods from an EJB

I have a need for multiple threads (e.g. Message Driven Beans) to access a shared object, lets say a singleton, I'm aware of the "you can't have a singleton in the EJB world" issues) for read/write operations, so the operations will need to be synchronised.
I've seen various statements such as you can't use read/write static fields in EJBs and you can't use synchronisation primitives in EJBs but I've also seen statements that say its okay to access utility classes such as Vector (which has synchronised methods) from an EJB.
Does anyone know if there is a definitive answer on this? What are the implications of accessing a shared object with synchronised methods from multiple EJBs? Is it just that the EJB's thread may block which limits the ability of the container to manage the EJBs? In the Vector example above (from Professional Java Server Programming) did they mean its okay to use these utility classes provided they aren't shared across threads?
If I can't use a plain old Java Object does anyone know if there are other potential solutions for sharing objects across EJBs?
In my problem, I have an operation that I want to run in a multi-threaded way. Each thread will add information to the shared object, and this info may be used by the other threads. There's no lengthy blocking as such other than the fact that only one thread can be adding/reading information from the shared object at a time.
I've trawled through this forum looking for similar questions of which there seem to be many, but there doesn't seem to be any definitive answers (sorry if there was and I missed it).
Thanks
Martin

You can share objects among EJB's or among objects used by one or more EJB's. You can use synchronization primitives - nothing will prevent you from doing that.
After all, the container classes, JVM-provides classes, JDBC, JCA, JNDI and other such classes do all of this with impunity. You can too. You can use file and socket I/O as well, presuming you configure the security profile to allow it. Should you? Well it depends on what you need to accomplish and if there is another practical alternative.
Yes the specification warns you not to, but you cannot be responsible for the interior hidden implementation of classes provided to you by the JVM or third parties so you can never truly know if your are breaking these written rules.
But when you do these things, you are taking over some part of the role of the container. For short running methods that only block while another thread is using the method or code block and no I/O or use of other potentially blocking operations are contained in the method/block, you will be fine. If you don't watch out and create deadlocks, you will harm the container and its managed thread pool.
You should not define EJB methods as synchronized.
Also, if you share objects between EJB's, you need to realize that the container is free to isolate pools of your EJB in separate classloaders or JVM's. It's behavior can be influenced by your packaging choices (use of .ear, multiple separate .jar's, etc.) and the configuration of the server esp. use of clustering. This will cause duplicate sets of shared classes - so singletons will not necessarily be singleton across the entire server/cluster, but no single EJB instance will see more than one of them. You design needs to be tolerant of that fact in order to work correctly.
This isn't the definitive answer you asked for - I'll leave that to the language/spec lawyers out there. But in my experience I have run across a number of occasions where I had to go outside of the written rules and ave yet to be burned for it.
Chuck

Similar Messages

  • I can't call more than 1 Java method from C

    Hi friends,
    I my program written in C i call two Java methods, but the first method execute correct but the second display a error message:
    Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x6d475879
    Function name=JVM_FindSignal
    Library=d:\jdk1.3.1\jre\bin\hotspot\jvm.dll
    I inverted the functions, but ever the second function makes a error.
    This is my C program:
    #include "jni.h"
    #include <stdio.h>
    #include <windows.h>
    #include <stdlib.h>
    #include <string.h>
    char *getclasspath()
    char ambiente[100000];
    static char result[200000];
    strcpy(ambiente,"-Djava.class.path=");
    strcat(ambiente,getenv("CLASSPATH"));
    int tam=strlen(ambiente),i,tamresult=0;
    for(i=0;i<tam;i++)
    if(ambiente!='\\')
    result[tamresult++]=ambiente[i];
    else
    result[tamresult++]='\\';
    result[tamresult++]='\\';
    result[tamresult]=0;
    return result;
    char **__stdcall getServerList(int sessionId)
         JavaVM *vm;
         JNIEnv *env;
         JavaVMInitArgs vm_args;
         JavaVMOption options[1];
         options[0].optionString = getclasspath();
         vm_args.version = JNI_VERSION_1_2;
         vm_args.options = options;
         vm_args.nOptions = 1;
         vm_args.ignoreUnrecognized = 1;
         jclass cls;
         jmethodID mid;
         char *retorno;
         int i=0;
         int k=0;
         int j=0;
         char aux[100][100];
         char *lista_server[20];
         char **lista_server_ret;
         /* Invoca a m�quina virtual Java */
         jint res = JNI_CreateJavaVM(&vm, (void **)&env, &vm_args);
         if (res < 0)
              printf("Can't create Java VM\n");
              exit(1);
         /* Procura pela classe */
         cls = (jclass) env->NewGlobalRef(env->FindClass("br.com.cpqd.sagre.security.argus.SagreWebWrapper"));
         if (cls == 0)
              printf("Can't found br.com.cpqd.sagre.security.argus.SagreWebWrapper class\n");
              exit(1);
         /* Procurando o metodo Java getListServerStr */
         if ((mid = env->GetStaticMethodID (cls,"getServerListStr","(I)Ljava/lang/String;")) == 0)
              fprintf (stderr,"Metodo nao encontrado Str\n");
              exit(1);
         jint param = (jint) sessionId;
         /* Executa o m�todo */
         jstring str_java = (jstring) env->CallStaticObjectMethod(cls,mid,param);
         retorno = (char *) env->GetStringUTFChars(str_java,0);
         vm->DestroyJavaVM ();
         int len = strlen(retorno);
         for(i=0;i<len;i++)
         if(retorno[i]!=' ')
              aux[k][j]= retorno[i];
              j++;
         else
              aux[k][j]='\0';
              k++;
              j=0;
         for(i=0;i<k;i++)
              lista_server[i] = aux[i];
         lista_server_ret=(char**)lista_server;
         return lista_server_ret;
    char __stdcall encrypt(char clearText)
    static JavaVM *vm;
    static JNIEnv *env;
    JavaVMInitArgs vm_args;
    JavaVMOption options[1];
    options[0].optionString = getclasspath();
    /*     "-Djava.class.path=.;.\\SagreUtil.jar";*/
    vm_args.version = JNI_VERSION_1_2;
    vm_args.options = options;
    vm_args.nOptions = 1;
    vm_args.ignoreUnrecognized = 1;
    jclass cls;
    jobject obj;
    jmethodID mid;
    char *retorno;
    /* Invoca a m�quina virtual Java */
    jint res = JNI_CreateJavaVM(&vm, (void **)&env, &vm_args);
    if (res < 0)
    printf("Can't create Java VM\n");
    /* Procura pela classe */
    cls = env->FindClass("br.com.cpqd.sagre.security.argus.SagreWebWrapper");
    if (cls == 0)
    printf("Can't find br.com.cpqd.sagre.security.argus.SagreWebWrapper class\n");
    /* Procurando o metodo Java encrypt */
    if ((mid = env->GetMethodID (cls,"encrypt","(Ljava/lang/String;)Ljava/lang/String;")) == 0)
    fprintf (stderr,"Can't find the encrypt method\n");
    exit(1);
    jstring param = (jstring) env->NewStringUTF (clearText);
    /* Instancia o metodo */
    obj = env->NewObject(cls,mid,param);
    /* Executa o m�todo encrypt */
    jstring str_java = (jstring) env->CallObjectMethod(obj,mid,param);
    if(str_java!=0)
    retorno = (char *) env->GetStringUTFChars(str_java, 0);
    else
         vm->DestroyJavaVM ();
         return NULL;
    /* Destroi JVM */
    vm->DestroyJavaVM ();
    return retorno;
    int main()
         char **teste;
         char *wilson;
         teste = getServerList(-1);
         printf("Fine %s",teste[1]);
         wilson = encrypt("blablabla");
         printf("%s",wilson);
    I appreciate for any reply.
    [ ]'s
    Bruno

    vikram ..
    if u r using ms vc++ then there is an option in the directories tab to specify various include files.
    if this doesn't work then u can use the command line compiler for vc++ , cl.exe. using cl u can give the -I option and specify the path of whatever file u want to add.
    as for the specific file <jni.h> u can find it at :
    driveletter:\jdk1.x\include
    though i have never used this file as an include statement in .c files that i use for jni.
    Dum Spiro Spero

  • How can we call "SP.UI.Notify.addNotification" methods in sharepoint designer page(.aspx) load without any onclick control?

    Hello Friends,
    How can we call "SP.UI.Notify.addNotification" methods in sharepoint designer page(.aspx) load without any onclick control?
    Scenario: When i was open my page i need to show below script,But here i used button control.
    <script type="text/javascript" src="/_layouts/14/MicrosoftAjax.js"></script><script src="/_layouts/14/sp.runtime.js" type="text/javascript"></script>
    <script src="/_layouts/14/sp.js" type="text/javascript"></script><script type="text/javascript">
    var strNotificationID;
    function showNofication()
     strNotificationID = SP.UI.Notify.addNotification("<font color='#AA0000'>In Progress..</font> <img src='/_Layouts/Images/kpiprogressbar.gif' align='absmiddle'> ", false);
    </script>
    <div class="ms-toolpanefooter"><input class="UserButton" onclick="Javascript:showNofication();" type="button" value="Show Nofitication"/> </div>
    Thanks
    Reddy

    Hi  Reddy,
    You can use the window.onload method for achieving your demand as below:
    <script type="text/javascript">
    window.onload=function(){
    </script>
    Hope this helps!
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • Accessing view object class (impl) method from bean (or vice versa)

    Halo everyone, I am using JDeveloper 11.1.2.1.0
    I have a UsersViewImpl class with a method which refresh the user table like below.
    public void resetEmployeeSearch() {
    removeApplyViewCriteriaName("viewCriteria");
    executeQuery();
    and I have a UserBean class with a method which reset the search fields values like below.
    public void resetInput(ActionEvent actionEvent) {
    ........RichInputText = input ...
    input.setValue("");
    AdfFacesContext.getCurrentInstance().addPartialTarget(searchForm);
    I would like to implement it in such a way that, once I press a button, both methods will be called.
    I have tried to call from bean method using UsersViewImpl vs = new UsersViewImpl ..... which is wrong and wont work.
    I have read about doing something like ViewObject vo = am.findViewObject("DeptView1") but I duno how to use it because I cant have a proper example.
    Any suggestion on accessing view object class (impl) method from bean (or vice versa)?
    Or is there any way to combine both method in the same class ?
    Thank you :(

    User, if you get class not found exceptions you need to tell us which classes you can't find. The JSFUtils and ADFUtils classes needing some other libraries which should already be part of your Fusion Web Application template (which your adf application should be based on). If you did not use this application template, you may have to add some libraries yourself.
    What is the diff of using the ADFUtils and OperationBinding way?
    The ADFUtils can get you access to the application module which you then use to call exposed methods on. The disadvantage of doing this is that you have to implement your own exception framework which then handles exceptions thrown by the application module. An other thing is that if you e.g. alter a VO which you use on the page this changes are not seen on the page until you refresh the page. The binding layer does not know about these changes so the iterators (which are used on the page to show the data) are not refreshed and so you don't see the changes.
    In general you should avoid using the application modul in a managed bean method and always use the binding layer (OperationBinding) to call methods. This ensures that exceptions are all handled the same way and that changes to the data model are reflected in the GUI.
    Timo

  • Can I call a .htm page of view1 from another .htm page of view 2?

    Hi,
    I have a viewset QuestionnaireTabVS with a view area TABS which has two views  QuestionCondnsVS (default) and View QuestionRisksVS.
    When a variable say GV_TAB  is set as 'Questions' it navigates to the QuestionCondnsVS view and when the variable GV_TAB is set as 'Risks' it navigates to the QuestionnaireRisksVS.
    This view set QuestionnaireTabVS is contained in an overview page which  has two Radiobuttons. It works fine when  the first radiobutton is selected, i.e, when I click on the Questions it renders the QuestionCondnsVS view and when I click on the Risks it renders me the QuestionRisksVS view .
    Problem is when  I had clicked the RISK tab first and then selected the another radiobutton the rendered view QuestionRisksVS doesnt get removed
    but is present there by default which I dont want.I want the QuestionCondnsVS view to be present there by default after the second radiobutton is selected. I tried to refresh all the controllers but somehow it navigates to the  QuestionRisksVS only .
    So i thought to call the  .htm page of QuestionCondnsVS forcefully from the QuestionnaireTabVS .htm page as soon as I select the another radiobutton.
    Can I call a .htm page of QuestionCondnsVS from another .htm page of  QuestionnaireTabVS? If yes then how or any other suggestion is welcome

    Hi Dharmakasi,
    The Radiobuttons code is not added in the same HTML page but lies in a different component where the coding is on event handler.
    METHOD eh_onchecked.
      DATA: lv_option TYPE REF TO if_bol_bo_property_access,
            lv_check  TYPE char1.
      lv_option ?= typed_context->switch->collection_wrapper->get_current( ).
      lv_check = lv_option->get_property_as_string( iv_attr_name = 'OPTION'   ).
      IF lv_check EQ zcl_gaf_adm_toolbox=>gv_matrix_mnt_type_old.
        zcl_gaf_adm_toolbox=>gv_matrix_mnt_type = zcl_gaf_adm_toolbox=>gv_matrix_mnt_type_old.
      ELSEIF lv_check EQ zcl_gaf_adm_toolbox=>gv_matrix_mnt_type_new.
        zcl_gaf_adm_toolbox=>gv_matrix_mnt_type = zcl_gaf_adm_toolbox=>gv_matrix_mnt_type_new.
      ELSEIF lv_check EQ zcl_gaf_adm_toolbox=>gv_matrix_mnt_type_scaf.
        zcl_gaf_adm_toolbox=>gv_matrix_mnt_type = zcl_gaf_adm_toolbox=>gv_matrix_mnt_type_scaf.
        ELSEIF lv_check EQ zcl_gaf_adm_toolbox=>gv_matrix_mnt_scaf_anz.
        zcl_gaf_adm_toolbox=>gv_matrix_mnt_type = zcl_gaf_adm_toolbox=>gv_matrix_mnt_scaf_anz.
      ELSEIF lv_check EQ zcl_gaf_adm_toolbox=>gv_matrix_mnt_type_sow.
        zcl_gaf_adm_toolbox=>gv_matrix_mnt_type = zcl_gaf_adm_toolbox=>gv_matrix_mnt_type_sow.
      ENDIF.
    ENDMETHOD.
    Here the LV_CHECK = old is the first radiobutton whereas LV_CHECk = new is the second radiobutton. I have tried to set the value of gv_tab ='Question' here but again no success.
    The .HTM coding of QuestionanireTABVS is
    <%@page language="abap" %>
    <%@extension name="thtmlb" prefix="thtmlb" %>
    <%@extension name="chtmlb" prefix="chtmlb" %>
    <%@extension name="bsp" prefix="bsp" %>
    <% data: ls_line                type CRMT_THTMLB_LINK,
             lv_flag                type ABAP_BOOL.
        data: lv_xml                type string.
    if zcl_gaf_adm_toolbox=>gv_matrix_mnt_type = zcl_gaf_adm_toolbox=>gv_matrix_mnt_type_old.
       REFRESH controller->gt_navlink_tab[].
    *   if controller->gt_navlink_tab[] is initial.
         ls_line-id = 'Questions'.
         ls_line-onclick = 'QUEST'.
         ls_line-text = page->otr_trim( 'ZGAF_CRM_70/QUESTIONS' ).
         insert ls_line into table controller->gt_navlink_tab.
         ls_line-id = 'Risks'.
         ls_line-onclick = 'RISK'.
         ls_line-text = page->otr_trim( 'ZGAF_CRM_70/GLOBAL_RISK' ).
         insert ls_line into table controller->gt_navlink_tab.
         %>
    <%--   endif.  %>--%>
    <thtmlb:tray id     = "HeaderExt"
                 indent = 'FALSE'
                 design = 'STANDARD'>
      <thtmlb:trayHeader>
        <thtmlb:grid cellSpacing = "0"
                 columnSize  = "1"
                 height      = "100%"
                 rowSize     = "1"
                 width       = "100%" >
          <thtmlb:gridCell colSpan     = "1"
                       columnIndex = "1"
                       rowIndex    = "1"
                       rowSpan     = "1"
                       >
            <thtmlb:navLink links  = "<%= controller->gt_navlink_tab %>"
                    selectedLinkId = "<%= controller->gv_tab %>" />
        <bsp:call comp_id = "<%= controller->GET_VIEWAREA_CONTENT_ID( 'TABS' ) %>"
                  url     = "<%= controller->GET_VIEWAREA_CONTENT_URL( 'TABS' ) %>" />
          </thtmlb:gridCell>
        </thtmlb:grid>
      </thtmlb:trayHeader>
      <thtmlb:trayBody>
        <%
    *    data: lv_xml    type string.
        lv_xml    = controller->CONFIGURATION_DESCR->GET_CONFIG_DATA( ).
        %>
        <chtmlb:config xml     = "<%= lv_xml %>"
                       mode    = "RUNTIME"  />
      </thtmlb:trayBody>
    </thtmlb:tray>
    <% elseif zcl_gaf_adm_toolbox=>gv_matrix_mnt_type = zcl_gaf_adm_toolbox=>gv_matrix_mnt_type_new.
       REFRESH controller->gt_navlink_tab[].
    *   if controller->gt_navlink_tab[] is initial.
         ls_line-id = 'Questions'.
         ls_line-onclick = 'QUEST'.
         ls_line-text = page->otr_trim( 'ZGAF_CRM_70/QUESTIONS' ).
         insert ls_line into table controller->gt_navlink_tab.
    *     ls_line-id = 'Risks'.
    *     ls_line-onclick = 'RISK'.
    *     ls_line-text = page->otr_trim( 'ZGAF_CRM_70/GLOBAL_RISK' ).
    *     insert ls_line into table controller->gt_navlink_tab.
         %>
    <%--   endif.  %>--%>
    <thtmlb:tray id     = "HeaderExt"
                 indent = 'FALSE'
                 design = 'STANDARD'>
      <thtmlb:trayHeader>
        <thtmlb:grid cellSpacing = "0"
                 columnSize  = "1"
                 height      = "100%"
                 rowSize     = "1"
                 width       = "100%" >
          <thtmlb:gridCell colSpan     = "1"
                       columnIndex = "1"
                       rowIndex    = "1"
                       rowSpan     = "1"
                       >
            <thtmlb:navLink links  = "<%= controller->gt_navlink_tab %>"
                    selectedLinkId = "<%= controller->gv_tab %>" />
        <bsp:call comp_id = "<%= controller->GET_VIEWAREA_CONTENT_ID( 'TABS' ) %>"
                  url     = "<%= controller->GET_VIEWAREA_CONTENT_URL( 'TABS' ) %>" />
          </thtmlb:gridCell>
        </thtmlb:grid>
      </thtmlb:trayHeader>
      <thtmlb:trayBody>
        <%
    *    data: lv_xml    type string.
        lv_xml    = controller->CONFIGURATION_DESCR->GET_CONFIG_DATA( ).
        %>
        <chtmlb:config xml     = "<%= lv_xml %>"
                       mode    = "RUNTIME"  />
      </thtmlb:trayBody>
    </thtmlb:tray>
    <% elseif zcl_gaf_adm_toolbox=>gv_matrix_mnt_type EQ zcl_gaf_adm_toolbox=>GV_MATRIX_MNT_TYPE_SCAF or
              zcl_gaf_adm_toolbox=>gv_matrix_mnt_type = zcl_gaf_adm_toolbox=>gv_matrix_mnt_scaf_anz  or
              zcl_gaf_adm_toolbox=>gv_matrix_mnt_type EQ zcl_gaf_adm_toolbox=>GV_MATRIX_MNT_TYPE_SOW.
       REFRESH controller->gt_navlink_tab[].
    *   if controller->gt_navlink_tab[] is initial.
         ls_line-id = 'Questions'.
         ls_line-onclick = 'QUEST'.
         ls_line-text = page->otr_trim( 'ZGAF_CRM_70/QUESTIONS' ).
         insert ls_line into table controller->gt_navlink_tab.
    *     ls_line-id = 'Risks'.
    *     ls_line-onclick = 'RISK'.
    *     ls_line-text = page->otr_trim( 'ZGAF_CRM_70/GLOBAL_RISK' ).
    *     insert ls_line into table controller->gt_navlink_tab.
         %>
    <%--   endif.  %>--%>
    <thtmlb:tray id     = "HeaderExt"
                 indent = 'FALSE'
                 design = 'STANDARD'>
      <thtmlb:trayHeader>
        <thtmlb:grid cellSpacing = "0"
                 columnSize  = "1"
                 height      = "100%"
                 rowSize     = "1"
                 width       = "100%" >
          <thtmlb:gridCell colSpan     = "1"
                       columnIndex = "1"
                       rowIndex    = "1"
                       rowSpan     = "1"
                       >
            <thtmlb:navLink links  = "<%= controller->gt_navlink_tab %>"
                    selectedLinkId = "<%= controller->gv_tab %>" />
        <bsp:call comp_id = "<%= controller->GET_VIEWAREA_CONTENT_ID( 'TABS' ) %>"
                  url     = "<%= controller->GET_VIEWAREA_CONTENT_URL( 'TABS' ) %>" />
          </thtmlb:gridCell>
        </thtmlb:grid>
      </thtmlb:trayHeader>
      <thtmlb:trayBody>
        <%
    *    data: lv_xml    type string.
        lv_xml    = controller->CONFIGURATION_DESCR->GET_CONFIG_DATA( ).
        %>
        <chtmlb:config xml     = "<%= lv_xml %>"
                       mode    = "RUNTIME"  />
      </thtmlb:trayBody>
    </thtmlb:tray>
    <% endif.
    %>

  • Problem generating Web Service with business methods in multiple EJB's

    Hi,
    I'm I a "web service novice" but I'm working with an
    application which was developed in an earlier version
    of Studio which has
    ~30 business method coming from ~12 EJB's. When I attempt
    to recreate the Web Service in Java Studio Enterprise 7 (had same problem versions 5 and 6) I have trouble. When I execute the "Generate Web Service Files" command I get complilation errors in the <webservice_name>.java file. It is obvious that the
    protected Map theJNDIMap = makeJNDIMap();
    protected Map makeJNDIMap() {
         Map m = new HashMap();
         // This map might get changed at deployment time
         m.put(......
    is all screwed up. Entries are missing and the closing bracket isn't even there.
    Is there some user error on my part?
    Is this a know bug (I couldn't any info. and I get the same behavior on the current and older versions of Studio)?
    Is there a workaround? I can fix this particular java file and compile it sucessfully. However, I'm still missing many of the other web service files that should be generated for me.
    All the tutorials on web services that I've done to looked over all get there business method from 1 EJB :(
    Please advise,
    Freda Phelps

    I had a problem too. Successfully created an EJB and its test application. Tested the same using Web client and works fine. Now created a web service from EJB methods. It created the skeletons. When tried creating Web Svc test client or web svc other files..it gives me an exception saying xmlservices.jar doesnt exist in the C:\Docs and Settings\<$username>\.jstudio\Ent04Q4modules. I have searched for this file and copied (overwritten) it into this directory. But still i cant proceed further.

  • Calling a css user created method from jspx page in ADF faces

    Hi all,
    Can anyone help me out to solve an issue calling a css user created method from a jspx page.
    Note: The css method is not the default css method. It needs to be called using 'styleClass' attribute in any tag.
    Thanks
    Neha

    Hi,
    I am not an expert in CSS so I don't know what a css method is. However, CSS can be applied to components via EL accessing a managed bean that returns the sytle text
    Frank

  • Please help to call oracle procedure with out paramter from shell script

    Hi
    I want to call a process with out parameter from shell script. I am calling process in shell script in below way
    function Process_loads {
    ( echo 'set serveroutput on size 1000000 arraysize 1'
    echo "set pagesize 0 term on verify off feedback off echo off"
    echo "BEGIN"
    echo " dbms_output.put_line('Before Calling The package'); "
    echo " x ( '$1', '$2', '$2', '$4', '$5', '$error_code'); "
    echo " dbms_output.put_line('After Calling The package'); "
    echo "EXCEPTION "
    echo " WHEN OTHERS THEN "
    echo " dbms_output.put_line('BIN_LOAD_ERROR' || SQLERRM); "
    echo " ROLLBACK;"
    echo "END;"
    echo "/" ) | sqlplus -s $USER/$PASSWORD@$SID
    Here $error_code is out paramter. All varaibles passed in process are declared with export command.
    When executing .sh it gives below error
    "sh ERROR at line 3: ORA-06550: line 3, column 99: PLS-00363: expression '' cannot be used as an assignment target ORA-06550: line 3, column 3: PL/SQL: Statement ignored".
    Please help to get rid from this error or please suggest how to call a oracle procedure with out paramter from unix shell script.
    Thanks in advance

    You can try this:
    From sql*plus
    SQL> ed
      1  create or replace procedure my_proc(p_id in int, p_result out int)
      2  as
      3  begin
      4  select 10 * p_id
      5  into p_result
      6  from dual;
      7* end my_proc;
    SQL> /
    Procedure created.
    SQL> set serveroutput on
    SQL> declare
      2  v_r int;
      3  begin
      4  my_proc(10,v_r);
      5  dbms_output.put_line(v_r);
      6  end;
      7  /
    100
    PL/SQL procedure successfully completed.
    from bash:
    testproc.sh:
    #!/bin/bash
    (echo 'set serveroutput on';
    echo 'declare';
    echo 'v_r int;';
    echo 'begin';
    echo 'my_proc(10,v_r);';
    echo 'dbms_output.put_line(v_r);'
    echo 'end;';
    echo '/';) | sqlplus -s u1/u1
    Console:
    oracle@mob-ubuntu:~$ chmod u+x testproc.sh
    oracle@mob-ubuntu:~$ ./testproc.sh
    100
    PL/SQL procedure successfully completed.With kind regards
    Krystian Zieja

  • How to call another view controller's method from a view controller?

    Hi,
    Iam new to webdynpro . so pls clarify my doubt.
    How to call another view controller's method from a view controller in the same Web Dynpro Component?
    Thanks,
    Krishna

    Hi,
         The methods in a view are only accessible inside same view. you cannot call it outside the view or
         in any other view although its in same component.
         If you want to have a method in both views, then create the method in component controller and
         from there you can access the method any where in whole component.

  • Can I call host file ( Unix Shell script ) from Oracle 10g trigger

    Hi,
    I am new to Oracle 10g. Can I call host file ( unix shell script ) from Oracle 10g trigger ?. I know it is possible. Pl explain me with small example
    thanks & regards
    parag

    user12009546 wrote:
    Hi,
    I am new to Oracle 10g. Can I call host file ( unix shell script ) from Oracle 10g trigger ?. I know it is possible. Pl explain me with small example
    thanks & regards
    paragIf you are in 10g, you can simple call shell script from DBMS_SCHEDULER:
    BEGIN
    DBMS_SCHEDULER.CREATE_JOB (
    job_name => 'TEST_SCRIPT',
    job_type => 'EXECUTABLE',
    job_action => 'PATH_OF_YOUR_SCRIPT',
    start_date => SYSDATE,
    repeat_interval => 'FREQ=MINUTELY; INTERVAL=1',
    enabled => TRUE,
    comments => 'Shell script from Oracle'
    END;
    /

  • Hi there. Can someone please help me with copying photos from my old iPad to my new one? Thanks.

    Hi there. Can someone please help me with copying photos from my old iPad to my new ipad2? Thanks.

    If you have a pc, when you plug your iPad in you should see the windows pop up window offering to backup the photos. Do that and it will save all your photos and videos to your computer where you can then sync them back to your new one.
    If the pop up doesn't come up, double click on my computer and navigate your way to the iPad. Double cick on it an d navigate to the DCIM folder. Drag your photos and videos to your pc, then sync them back onto your iPad.

  • Custom sendemail in sharepoint 2013 designer workflow using dictionary object with email template from list

    I  am looking for custom sendemail in sharepoint 2013 designer workflow using dictionary object with email template from list
    MCTS Sharepoint 2010, MCAD dotnet, MCPDEA, SharePoint Lead

    Hi Greetings.
    pls check if it helps you.
    http://msdn.microsoft.com/en-us/library/office/jj554504(v=office.15).aspx
    Please remember to click 'Mark as Answer' on the answer if it helps you

  • How can i call the certificate selection dialog box from source code?

    How can i call the certificate selection dialog box from source code?
    NB: Of course if i have more than one certificate in the Microsoft Keystore 'My'.
    Thank You in advance

    I found an example of the "TestStand UI Expression Control.ctl" and it works just the way I need it. (check the link)
    Proper use of "TestStand UI ExpressionEdit Control" in LabVIEW http://forums.ni.com/ni/board/message?board.id=330&requireLogin=False&thread.id=10609 
    The "Expression Browser Dialog Box Button" F(x) stays disable while editing the VI, however it become available when the VI is called from TestStand.
    Thank you,
    Hecuba
    Mfg. Test Engineer
    Certified LabVIEW Associate Developer

  • Can you install osx lion with thumb drive from 10.6.3

    can you install osx lion with thumb drive from 10.6.3

    No. You can install Snow Leopard with a flash drive 10.6.3 installer. However, for Lion you must start with 10.6.8 in order to access the App Store to purchase and download Lion.

  • How can I get the variable with the value from Thread's run method

    We want to access a variable from the run method of a Thread externally in a class or in a method. Even though I make the variable as public /public static, I could get the value till the end of the run method only. After that scope of the variable gets lost resulting to null value in the called method/class..
    How can I get the variable with the value?
    This is sample code:
    public class SampleSynchronisation
         public static void main(String df[])
    sampleThread sathr= new sampleThread();
    sathr.start();
    System.out.println("This is the value from the run method "+sathr.x);
    /* I should get:
    Inside the run method
    But I get only:
    Inside*/
    class sampleThread extends Thread
         public String x="Inside";
         public void run()
              x+="the run method";
    NB: if i write the variable in to a file I am able to read it from external method. This I dont want to do

    Your main thread continues to run after the sathr thread is completed, consequently the output is done before the sathr thread has modified the string. You need to make the main thread pause, this will allow sathr time to run to the point where it will modify the string and then you can print it out. Another way would be to lock the object using a synchronized block to stop the main thread accessing the string until the sathr has finished with it.

Maybe you are looking for

  • Scripts totals prinint in main window

    Hi, i want to print gross value, discount,output tax and total amount after printing all line items in main window. can any one tell me where i have to write the code for this gross value, discount,output tax and total amount. i mean how to check the

  • Sidebar Gone, Windows 7 Home Premium 64bit

    After installing windows, my system installed a bunch of updates. After the updates, my sidebar dissapeared. I tried a few things i found online... Like registering the libraries again, deleting a registry entry, but nothing works.... Any ideas?

  • SP Not firing

    Hi I am new to SP.I written a code which is executed at back end succesfully but its not firing at front end. I used this SP to restrict the user to change the unit price(Comes automatically from item master) for a particular item group in PO.its not

  • Newbie question about switch statement

    Lets say you have a loop and inside the loop you have a switch statement, how do you BREAK out of the outer loop? for (i=0....) { switch { case 11: .... some stuff break; <==== HOW DO I BREAK OUT OF THE for loop here?

  • How is the disposable net calculated for garnishment?

    Hi experts, In IMG, I tried to create new adjustment model for diposable net. But I found out some entries are there trying to substract the amount paid for other garnishment (such as child support). So suppose I have two garnishments, one is Child s