Advanced Customization > Info*Engine User’s Guide > SOAP Services > Example Standalone Java SOAP Client > Creating a Connection Handle
  
Creating a Connection Handle
Connection handles (instances of javax.resource.cci.Connection) are used to create interactions with Info*Engine. Connection handles do not represent physical connections to Info*Engine. As a result, invoking Connection.close() does not necessarily close the physical connection. Instead, it simply frees the connection handle and allows the physical connection to be returned to a connection pool for later reuse.
Connection handles should always be closed when you are finished using them. Ideally, closing of a connection handle should be performed in a FINALLY block to ensure that, regardless of error conditions, the handle is freed properly and the physical connection can be reused. If this is not done, physical connections can remain marked as busy and never be properly cleaned up. The underlying connection manager is responsible for connection pooling and closing bad or expired physical connections. These are details your source code does not need to deal with.
Connection handles can be retrieved using a connection factory (instance of javax.resource.cci.ConnectionFactory). There are potentially two ways of getting an instance of a connection factory:
The connection factory can be manually configured and created in Java source code.
The connection factory can be retrieved from an LDAP directory.
Looking up a connection factory from an LDAP directory is the preferable method for the following reasons:
Manually configuring and creating the connection factory in source may require code changes if the SOAP service were to move.
Storing the connection factory in an LDAP directory allows many clients to share the connection factory’s configuration.
In this situation updating the location of the SOAP service would only need to be reconfigured in a single place, as opposed to wherever a SOAP client resides. As long as the location of the LDAP directory does not change, clients do not need to be updated.