Skip to Content
avatar image
Former Member

To Close the JCo connection

Dear All

I have a scenario. In that I am using 4 Views. And I have 3 separate models. I want to close the Connection explicitly when I go back from 4th View to 1st View.

The control flow is like this

V1-- >V2 -- >V3 ->V4 ---V1. and it continues.

How can I acheive this? I want to close all the Connections before going again to 1st View.

The user may exit from any View. At that time also I want to Close.

Where should I write the close connection coding?

	 <ModelName> search=(<ModelName>)WDModelFactory.getModelInstance(<ModelName>.class);
	 search.disconnectIfAlive();

Can anybody help me in this?

Regards

Aparnna




Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Mar 31, 2007 at 04:12 AM

    Hi,

    Execute your FNmodule u need to mention the try catch() method.

    Simply mention the Connection close method in ..

    try{

    execute method()

    } catch(Exception e)

    {

    e.printkStrace();

    }

    finally{

    close connection;

    }

    It might helps u.

    Thanks,

    Lohi.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 31, 2007 at 05:56 AM

    Hi Aparnna ,

    you can write this

    <ModelName> search=(<ModelName>)WDModelFactory.getModelInstance(<ModelName>.class);

    search.disconnectIfAlive();

    after try catch Statements where you execute your model.

    or

    You can also write...

    wdContext.current<ModelName>.modelObject().modelInstance().disconnectIfAlive()

    Regards

    Sunitha

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      We have wrote the same code after executing the model exactly like you have mentioned above, still we are getting the same error.

      <ModelName> search=(<ModelName>)WDModelFactory.getModelInstance(<ModelName>.class);

      search.disconnectIfAlive();

      Please Provide any other suggestion to solve the error.

      Regards

      Aparnna

  • Mar 31, 2007 at 11:19 AM

    Hi Aparna ,

    I suggest You to execute your code for disconnecting RFC connection

    in a seperate method. Your code must be enclosed with exception Handling codes.

    You can place this method in your component Conroller[Reason: you can call your method from any View ,Incase u may close the connection at any view] and call this method after the Last model execution or in the view4.

    Regards,

    Ramganesan K.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      try this when instance model context...

      MDL_Customer_Data_Create model_Customer_Data_Create = (MDL_Customer_Data_Create) WDModelFactory.getModelInstance(MDL_Customer_Data_Create.class, WDModelScopeType.TASK_SCOPE);

      model_Customer_Data_Create.disconnectIfAlive();

      Z_Hyd_0192_Ep_Input bapIn_Z_Hyd_0192_Ep = (Z_Hyd_0192_Ep_Input) model_Customer_Data_Create.createModelObject(Z_Hyd_0192_Ep_Input.class);

      bapIn_Z_Hyd_0192_Ep.setE_Customer_Data(new Zzep_Customer_Data());

      wdContext.nodeZ_Hyd_0192_Ep_Input().bind(bapIn_Z_Hyd_0192_Ep);

  • avatar image
    Former Member
    Mar 31, 2007 at 02:31 AM

    Hi Aparna,

    No need to close the JCO connections manually, vwhen you create JCo connections you will set connection time in milli seconds. By deafult its value is 10 msec. the connection will be closed , after the time specified.

    Regards,

    Siva.

    Add comment
    10|10000 characters needed characters exceeded