Connecting to the server – PB Docs 2018

Connecting to the server

The EJBConnection class is used to connect to an EJB server and
locate an EJB. It has four methods: ConnectToServer, DisconnectServer,
Lookup, and GetEJBTransaction.

To establish a connection to the server, you need to execute the
PowerScript statements required to perform these operations:

  1. Declare an instance of the EJBConnection class.

  2. Set properties for the EJBConnection object.

  3. Use the CREATE statement to instantiate the EJBConnection
    object.

  4. Invoke the ConnectToServer method to establish a connection to
    the server.

  5. Check for errors.

Class path requirements

To connect to the application server and create an EJB object, the
system CLASSPATH environment variable or the classpath argument of
createJavaVM must contain the location of the EJB stub files, either a
directory or a JAR file. The application server you are using might also
require that some classes or JAR files be available on the client computer
and added to the class path. For more information, see The Java VM classpath in the development
environment
.

Setting the initial context

The string used to establish the initial context depends on the EJB
server. The following table shows sample string values. See the
documentation for your server for more information.

Server

INITIAL_CONTEXT_FACTORY value

WebLogic

weblogic.jndi.WLInitialContextFactory

WebSphere

com.ibm.websphere.naming.WsnInitialContextFactory

Example

The following script shows a connection to WebLogic. It sets
connection properties to create an initial context, to identify the host
name and port number of the server, and to identify the user ID and
password.

Then, the script creates an instance of the EJBConnection object,
invokes the ConnectToServer method to establish a connection to the
server, and checks for errors:

Disconnecting from the
server

When your application has finished using the EJB server, it should
disconnect from the server:


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x