Package 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

  Modifier and Type
  Method
  Description
  `DataSource`
  `build()`
  Builds a non-pooling DataSource.
  `DataSourceBuilder`
  `driver(String driver)`
  `DataSourceBuilder`
  `driver(Driver 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 Details

  - ### 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.