# Class CayenneDataSource

java.lang.Object
org.apache.cayenne.datasource.CayenneDataSource

public class CayenneDataSource extends Object
An entry point for manually building DataSources. Produces instances of Cayenne own DataSource. Alternatively, you can use any JDBC-compliant third-party DataSources with Cayenne.

Since:
  5.0

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `CayenneDataSource.Builder`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static CayenneDataSource.Builder`
  `fromProperties(Map<String,String> properties)`
  Starts building a DataSource with settings taken from the following map keys: cayenne.jdbc.url cayenne.jdbc.driver cayenne.jdbc.username cayenne.jdbc.password cayenne.jdbc.min_connections cayenne.jdbc.max_connections cayenne.jdbc.max_wait cayenne.jdbc.validation_query The URL property is required.
  `static CayenneDataSource.Builder`
  `fromProperties(Map<String,String> properties, String nodeName)`
  Starts building a DataSource with settings taken from a properties map, same as `fromProperties(Map)`, but first checking properties with a ".nodeName" suffix (e.g.
  `static CayenneDataSource.Builder`
  `of(String url)`
  Starts building a DataSource for the given database URL.

  ### Methods inherited from class Object

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

- ## Method Details

  - ### of

    public static CayenneDataSource.Builder of(String url)
    Starts building a DataSource for the given database URL.

  - ### fromProperties

    public static CayenneDataSource.Builder fromProperties(Map<String,String> properties)
    Starts building a DataSource with settings taken from the following map keys:
    - cayenne.jdbc.url
    - cayenne.jdbc.driver
    - cayenne.jdbc.username
    - cayenne.jdbc.password
    - cayenne.jdbc.min_connections
    - cayenne.jdbc.max_connections
    - cayenne.jdbc.max_wait
    - cayenne.jdbc.validation_query
    The URL property is required. Pooling is enabled if at least one of the connections count properties is set. Within the Cayenne stack, use `RuntimeProperties.toMap()` to pass the runtime properties here.

  - ### fromProperties

    public static CayenneDataSource.Builder fromProperties(Map<String,String> properties, String nodeName)
    Starts building a DataSource with settings taken from a properties map, same as `fromProperties(Map)`, but first checking properties with a ".nodeName" suffix (e.g. "cayenne.jdbc.url.mynode"), and falling back to the unsuffixed ones.