Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Intercomponent EJB calls

2 posts in General Discussion (old) Last posting was on 2000-02-25 00:30:30.0Z
Daniel Montero Posted on 2000-02-24 23:17:15.0Z
Newsgroups: sybase.public.easerver
Date: Thu, 24 Feb 2000 17:17:15 -0600
From: Daniel Montero <danim@gruposoin.com.mx>
Organization: Grupo SOIN, S.A. de C.V.
X-Mailer: Mozilla 4.7 [en] (WinNT; U)
X-Accept-Language: en
MIME-Version: 1.0
Subject: Intercomponent EJB calls
Content-Type: multipart/alternative; boundary="------------D681D3EBFAF615A6E0FA7EE7"
Lines: 78
NNTP-Posting-Host: na-28-221.na.avantel.net.mx 148.245.28.221
Message-ID: <347_38B5BBFB.6D36B2A4@gruposoin.com.mx>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.easerver:27855
Article PK: 159560

Hi.
How can I make EJB intercomponent calls?
do I need to have same code that I use to call a component from a client, or is there a shortcut to do this, like in CORBA intercomponent calls?
Now I am doing this:

 static public Context getInitialContext() throws Exception {
  java.util.Properties p = new java.util.Properties();
  p.put(Context.INITIAL_CONTEXT_FACTORY,
     "com.sybase.ejb.InitialContextFactory");
  p.put(Context.PROVIDER_URL, "iiop://danim:9000");
  p.put(Context.SECURITY_PRINCIPAL, "jagadmin");
  p.put(Context.SECURITY_CREDENTIALS, "");
  return new InitialContext(p);
}
void callComponent() {
   Context ctx = getInitialContext();
   EmisoraHome eh = (EmisoraHome) ctx.lookup("Emisora");
   Emisora e = eh.findByPrimaryKey("S.I.FINLAT3-1");
   double valor = e.valuar(0);
   lb_1.addItem("Valor: " + valor);
   e = null;
   ctx = null;
}

TIA,
    danim

--
------
Make a free donation of food
Haga una donacion sin costo de comida

http://www.thehungersite.com
------
Daniel Montero
danim@gruposoin.com.mx
http://www.gruposoin.com.mx/
 


Evan Ireland Posted on 2000-02-25 00:30:30.0Z
Newsgroups: sybase.public.easerver
Date: Fri, 25 Feb 2000 13:30:30 +1300
From: Evan Ireland <eireland@sybase.com>
Organization: Sybase, Inc.
X-Mailer: Mozilla 4.7 [en] (WinNT; U)
X-Accept-Language: en
MIME-Version: 1.0
To: Daniel Montero <danim@gruposoin.com.mx>
Subject: Re: Intercomponent EJB calls
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 37
NNTP-Posting-Host: vpn-eme-022.sybase.com 130.214.8.22
Message-ID: <347_38B5CD26.588CFE7D@sybase.com>
References: <347_38B5BBFB.6D36B2A4@gruposoin.com.mx>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.easerver:27853
Article PK: 159557


Daniel Montero wrote:
>
> Hi.
> How can I make EJB intercomponent calls?
> do I need to have same code that I use to call a component from a client, or is there a shortcut to do this, like in CORBA intercomponent calls?
> Now I am doing this:
>
> static public Context getInitialContext() throws Exception {
> java.util.Properties p = new java.util.Properties();
> p.put(Context.INITIAL_CONTEXT_FACTORY,
> "com.sybase.ejb.InitialContextFactory");
> p.put(Context.PROVIDER_URL, "iiop://danim:9000");
> p.put(Context.SECURITY_PRINCIPAL, "jagadmin");
> p.put(Context.SECURITY_CREDENTIALS, "");
> return new InitialContext(p);
> }
> void callComponent() {
> Context ctx = getInitialContext();
> EmisoraHome eh = (EmisoraHome) ctx.lookup("Emisora");
> Emisora e = eh.findByPrimaryKey("S.I.FINLAT3-1");
> double valor = e.valuar(0);
> lb_1.addItem("Valor: " + valor);
> e = null;
> ctx = null;
> }

That's basically what you need to do, although with pooled EJB components you
can create the InitialContext in the set(Session,Entity)Context method and
avoid creating additional context objects each time you need to do an
intercomponent call.
________________________________________________________________________________

Evan Ireland Sybase EA Server Engineering eireland@sybase.com
Wellington - New Zealand +64 4 934-5856