[id='jdbc_connection_pooling']
= Connection Factories
`JdbcStringBasedStore` relies on a `ConnectionFactory` implementation to connection to a database.

{brandname} provides the following `ConnectionFactory` implementations:

.`PooledConnectionFactoryConfigurationBuilder`
A connection factory based on Agroal that you configure via `PooledConnectionFactoryConfiguration`.

Alternatively, you can specify configuration properties prefixed with `org.infinispan.agroal.` as in the following example:

[source,properties,options="nowrap",subs=attributes+]
----
include::config_examples/example_agroal.properties[]
----

You then configure {brandname} to use your properties file via
`PooledConnectionFactoryConfiguration.propertyFile`.

[NOTE]
====
You should use `PooledConnectionFactory` with standalone deployments, rather
than deployments in servlet containers.
====

.`ManagedConnectionFactoryConfigurationBuilder`
A connection factory that you can can use with managed environments such as
application servers. This connection factory can explore a configurable
location in the JNDI tree and delegate connection management to the
`DataSource`.

.`SimpleConnectionFactoryConfigurationBuilder`
A connection factory that creates database connections on a per invocation basis. You should use this connection factory for test or development
environments only.

.Reference

* link:https://agroal.github.io/[Agroal]
* link:{javadocroot}/org/infinispan/persistence/jdbc/configuration/ConnectionFactoryConfigurationBuilder.html[ConnectionFactoryConfigurationBuilder]
* link:{javadocroot}/org/infinispan/persistence/jdbc/configuration/PooledConnectionFactoryConfigurationBuilder.html[PooledConnectionFactoryConfigurationBuilder]
*  link:{javadocroot}/org/infinispan/persistence/jdbc/configuration/ManagedConnectionFactoryConfigurationBuilder.html[ManagedConnectionFactoryConfigurationBuilder]
*  link:{javadocroot}/org/infinispan/persistence/jdbc/configuration/SimpleConnectionFactoryConfigurationBuilder.html[SimpleConnectionFactoryConfigurationBuilder]
