Oracle8i Enterprise JavaBeans Developer's Guide and Reference Release 3 (8.1.7) Part Number A83725-01 |
|
The client example in Chapter 2 showed how to connect to Oracle, start a database server session, and activate an object using a single URL specification. This was performed through the following steps:
1. Hashtable env = new Hashtable(); 2. env.put(javax.naming.Context.URL_PKG_PREFIXES, "oracle.aurora.jndi"); 3. env.put(javax.naming.Context.SECURITY_PRINCIPAL, username); 4. env.put(javax.naming.Context.SECURITY_CREDENTIALS, password); 5. env.put(javax.naming.Context.SECURITY_AUTHENTICATION,
ServiceCtx.NON_SSL_LOGIN); 6. Context ic = new InitialContext(env); 7. HelloHome hello_home = (HelloHome) ic.lookup("sess_iiop://localhost:2481:ORCL/test/myHello"); myHello hello = hello_home.create (); 8. System.out.println(hello.helloWorld());
In this example, there are four basic operations:
When a client looks up an object through the JNDI lookup
method, the client and server automatically perform the following logic:
/test/myHello
, is located in the session namespace and a reference to it is returned to the client.
When the client invokes a method--such as helloWorld()
--on the returned reference, the server activates the object in the server.
|
![]() Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
|