org.apache.cayenne.datasource

## Class DataSourceBuilder

- java.lang.Object
- - org.apache.cayenne.datasource.DataSourceBuilder

-     public class DataSourceBuilder
      extends Object

  A builder class that allows to build a `DataSource` with optional pooling.
  Since:
    4.0

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `DataSource` | `build()` Builds a non-pooling DataSource.
    `DataSourceBuilder` | `driver(Driver driver)`
    `DataSourceBuilder` | `driver(String driver)`
    `DataSourceBuilder` | `password(String password)`
    `PoolingDataSourceBuilder` | `pool(int minConnection, int maxConnections)` Turns produced DataSource into a pooled DataSource.
    `static DataSourceBuilder` | `url(String url)`
    `DataSourceBuilder` | `userName(String userName)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### url

          public static DataSourceBuilder url(String url)

    - #### userName

          public DataSourceBuilder userName(String userName)

    - #### password

          public DataSourceBuilder password(String password)

    - #### driver

          public DataSourceBuilder driver(String driver)

    - #### driver

          public DataSourceBuilder driver(Driver driver)

    - #### pool

          public PoolingDataSourceBuilder pool(int minConnection,
                                               int maxConnections)

      Turns produced DataSource into a pooled DataSource.

    - #### build

          public DataSource build()

      Builds a non-pooling DataSource. To create connection pool use `pool(int, int)` method.

Copyright © 2001–2023 Apache Cayenne. All rights reserved.