|Oracle8i Enterprise JavaBeans and CORBA Developer's Guide
The examples in Chapter 3, "Developing CORBA Applications" and Chapter 2, "Enterprise JavaBeans" showed how to connect to Oracle, start a database server session, and activate a CORBA server object or an EJB, using a single URL specification. In the client examples, connection and object look up was done as follows:
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. myHello hello = (myHello) ic.lookup("sess_iiop://localhost:2481:ORCL/test/myHello"); 8. System.out.println(hello.helloWorld());
In this example there are four basic operations:
In line 7 above, when a client looks up an object, the client and server are doing a lot of things automatically:
lookup()invocation, a session IIOP connection is made to the ORCL instance of the localhost database.
/test/myHelloServerin the session namespace.
When the object reference is returned, the client can invoke a method such as
helloWorld() on the activated, narrowed object, as in line 8 above. This example shows a CORBA server object being looked up and activated, but a similar set of steps, including the narrowing, occurs when an EJB is activated through its home interface.
In the remainder of this chapter the connection, service and session context establishment, and authentication steps are broken out and described separately. There are many code examples to show you how to control session invocation in a much finer-grained way than in the basic example above.
This chapter also describes various kinds of client authentication in addition to the NON_SSL_LOGIN method that the basic examples use. This chapter also discusses other aspects of security.