5.3. Connection Management
Prev | Chapter 5. JDBC Configuration | Next

## 5.3. Connection Management

By default, Kodo performs database connection pooling with its own `javax.sql.DataSource` implementation. The numbers provided in the `javax.jdo.option.MinPool` and `javax.jdo.option.MaxPool` configuration properties specify the number of connections that the pool should maintain. You can also manage connections yourself by setting the `ConnectionFactory` of the `PersistenceManagerFactory` to your own `javax.sql.DataSource`. Alternatively, you can set the `javax.jdo.option.ConnectionFactoryName` configuration property to the JNDI location of a bound `javax.sql.DataSource`.

If you would prefer to use a `javax.sql.DataSource` other than Kodo's built-in pooling implementation, you can set the DataSource's class name in the javax.jdo.option.ConnectionDriverName property, and specify the bean properties in the com.solarmetric.kodo.ConnectionProperties property. In these cases, the javax.jdo.option.ConnectionURL property will be unused.

Example 5.2. Properties for using a custom DataSource

    javax.jdo.option.ConnectionDriverName=oracle.jdbc.pool.OracleDataSource
    com.solarmetric.kodo.ConnectionProperties=PortNumber=1521 \
                                              ServerName=saturn \
                                              DatabaseName=solarsid \
                                              DriverType=thin
    javax.jdo.option.ConnectionUserName=jdotestuser
    javax.jdo.option.ConnectionPassword=jdotestpassword

| Important
Kodo's built-in DataSource implementation performs advanced connection pooling and caching of `PreparedStatement`. Using a third-party DataSource that does not provide these feature may result in sub-optimal Kodo performance.

Prev | Up | Next
5.2. Accessing Multiple Databases | Home | 5.4. Large Result Sets