Saving and reusing connection factories

When a connection factory has been created it can be saved and reused so that the application does not have to create one.

In a JEE application server environment, IBM® recommends that you register your connection factory object, which has links to your enterprise information system connection information, in the JNDI (Java Naming Directory Interface) service. This makes upgrade from nonmanaged to managed Java™ environments easier because applications can acquire connection factory objects in the same way. However, this might not be possible outside a JNDI environment unless either an LDAP server, or an appropriate JNDI service provider is available within your environment.

Connection factories support the serializable and referenceable Java interfaces. This means that you can decide how to register them in the JNDI. For more information see the JEE Connector Architecture Specification.

If you plan to use serializable interfaces see Tracing issues relating to serialized interfaces and ConnectionFactory objects for more information on how serialization and deserialization of connection factory objects affects the setting of the LogWriter property.