In the JNDI service of the application server, you have to execute a lookup()
for a preconfigured connection factory. A connection factory provides a getConnection()
method that returns a Connection
object. During the deployment of the connection factory the properties of this connection (EIS address, EIS service name, etc.) were configured. No matter which type of connection factory has been deployed (EISUpicConnectionFactory
or EISOltpConnectionFactory
), a Connection
object that implements the EISConnection
interface is always returned. When the application no longer needs a Connection
object, it must return it to the application server for pooling or destruction by issuing the close()
method for the Connection
object.
The application must make sure that it also releases the requested connections with close()
when errors occur. Otherwise, secondary errors may occur in the application server.
It is recommended that the JNDI lookup()
for a connection factory is executed during initialization. In an EJB this can, for example, take place within the ejbCreate()
or setSessionContext()
method.
The getConnection()
method and the associated close()
method must be called directly within the business methods.