This section introduces the 2 connection factories supplied
StandaloneConnectionFactory: This connection factory creates a new connection to the database every time a user requests a connection. Since this factory uses the simplest interfaces declared in jdbc specification, any jdbc compliant driver can be used with this connection factory. Since a new connection is created on every call there is a penalty involved in using this connection factory. We recommend that this implementation be used only in the simplest applications.
NamedDataSourceConnectionFactory: JDBC 2.0 introduced the concept of datasources. "A DataSource object is a factory for Connection objects. An object that implements the DataSource interface will typically be registered with a JNDI service provider." The NamedDataSourceConnectionFactory retrieves connections from a configured data source which has been registered in a jndi tree (e.g. ldap) Since a datasource typically pool connections, it has a better performance in comparision with the StandaloneConnectionFactory, since the overhead of creating a new connection with every call isnt present.