ConnectToServer
Description
Connects a client application to an EJB server. The client
application must call ConnectToServer before it can use a remote object
on the server.
Syntax
|
1 |
connection.ConnectToServer ( string properties[ ] ) |
|
Argument |
Description |
|---|---|
|
connection |
The name of the EJBConnection object you want to |
|
properties[ ] |
A string array used to pass name/value pairs that |
Return value
None
Throws
NamingException
Examples
In this example, the client application connects to a WebLogic
server application using the Connection object called conn:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
ejbconnection conn helloejbhome hellohome helloejb hello string properties[ ] string msg // Type each of the following statements on one line properties[1]="javax.naming.Context.INITIAL_CONTEXT_FACTORY=weblogic.jndi.WLInitialContextFactory" properties[2]="javax.naming.Context.PROVIDER_URL=t3://svr1:7001" properties[3]="javax.naming.Context.SECURITY_PRINCIPAL=myid" properties[4]="javax.naming.Context.SECURITY_CREDENTIALS=mypass" conn = create ejbconnection TRY conn.connectToServer(properties) CATCH (remoteexception re) messagebox("remoteexception", re.GetMessage()) CATCH (createexception ce) messagebox("createexception", ce.GetMessage()) END TRY |
Usage
You must provide ConnectToServer with a set of properties that
specify how the connection will be established. Before calling
ConnectToServer, declare a string array variable and assign values for
the javax.naming.Context constants shown in the following table to the
elements of the array.
|
javax.naming.context constant |
Value |
|---|---|
|
INITIAL_CONTEXT_FACTORY |
Server dependent. For WebLogic: weblogic.jndi.WLInitialContextFactory WebSphere: com.ibm.websphere.naming.WsnInitialContextFactory |
|
PROVIDER_URL |
URL for the Server’s port. For example: |
|
SECURITY_PRINCIPAL |
User name required for access to the |
|
SECURITY_CREDENTIALS |
Credentials associated with the user name, |
See also