com.holonplatform.jdbc

## Interface DataSourceBuilder.Builder

- All Known Implementing Classes:
    DefaultDataSourceBuilder.DefaultBuilder
  Enclosing interface:
    DataSourceBuilder

      public static interface DataSourceBuilder.Builder

  Direct `DataSource` instance builder.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `DataSourceBuilder.Builder` | `autoCommit(boolean autoCommit)` Set the DataSource connection auto-commit mode.
    `DataSource` | `build()` Build the `DataSource`.
    `DataSourceBuilder.Builder` | `database(DatabasePlatform databasePlatform)` Set the database platform to which the DataSource is connected.
    `DataSourceBuilder.Builder` | `driverClassName(String driverClassName)` Set the JDBC driver class name.
    `DataSourceBuilder.Builder` | `maxPoolSize(int maxPoolSize)` For connection pooling DataSources, set the upper limit of the connections pool.
    `DataSourceBuilder.Builder` | `minPoolSize(int minPoolSize)` For connection pooling DataSources, set the lower limit of the connections pool.
    `DataSourceBuilder.Builder` | `name(String name)` Set the DataSource instance name, if supported by concrete DataSource implementation.
    `DataSourceBuilder.Builder` | `password(String password)` Set the JDBC connection password.
    `DataSourceBuilder.Builder` | `type(DataSourceType type)` Set the DataSource type.
    `DataSourceBuilder.Builder` | `type(String typeName)` Set the DataSource type name.
    `DataSourceBuilder.Builder` | `url(String url)` Set the JDBC connection URL.
    `DataSourceBuilder.Builder` | `username(String username)` Set the JDBC connection username.
    `DataSourceBuilder.Builder` | `validationQuery(String validationQuery)` For connection pooling DataSources, set the connection validation query.
    `DataSourceBuilder.Builder` | `withInitScript(String sqlScript)` Add a SQL intitialization script.
    `DataSourceBuilder.Builder` | `withInitScriptResource(String sqlScriptResourceName)` Add a SQL intitialization script read from given classpath resource name (for example a file name).

- - ### Method Detail

    - #### type

          DataSourceBuilder.Builder type(String typeName)

      Set the DataSource type name.
      Parameters:
        `typeName` - the DataSource type name (not null)
      Returns:
        this

    - #### type

          DataSourceBuilder.Builder type(DataSourceType type)

      Set the DataSource type.
      Parameters:
        `type` - the DataSource type (not null)
      Returns:
        this

    - #### name

          DataSourceBuilder.Builder name(String name)

      Set the DataSource instance name, if supported by concrete DataSource implementation.
      Parameters:
        `name` - the DataSource name
      Returns:
        this

    - #### driverClassName

          DataSourceBuilder.Builder driverClassName(String driverClassName)

      Set the JDBC driver class name.
      Parameters:
        `driverClassName` - the JDBC driver class name
      Returns:
        this

    - #### url

          DataSourceBuilder.Builder url(String url)

      Set the JDBC connection URL.
      Parameters:
        `url` - the JDBC connection URL
      Returns:
        this

    - #### username

          DataSourceBuilder.Builder username(String username)

      Set the JDBC connection username.
      Parameters:
        `username` - the JDBC connection username
      Returns:
        this

    - #### password

          DataSourceBuilder.Builder password(String password)

      Set the JDBC connection password.
      Parameters:
        `password` - the JDBC connection password
      Returns:
        this

    - #### database

          DataSourceBuilder.Builder database(DatabasePlatform databasePlatform)

      Set the database platform to which the DataSource is connected.

      Can be used for example to auto-detect a suitable JDBC driver.

      Parameters:
        `databasePlatform` - the database platform
      Returns:
        this

    - #### autoCommit

          DataSourceBuilder.Builder autoCommit(boolean autoCommit)

      Set the DataSource connection auto-commit mode.
      Parameters:
        `autoCommit` - `true` to enable connection auto-commit, `false` to disable
      Returns:
        this

    - #### minPoolSize

          DataSourceBuilder.Builder minPoolSize(int minPoolSize)

      For connection pooling DataSources, set the lower limit of the connections pool.
      Parameters:
        `minPoolSize` - Minimum connection pool size
      Returns:
        this

    - #### maxPoolSize

          DataSourceBuilder.Builder maxPoolSize(int maxPoolSize)

      For connection pooling DataSources, set the upper limit of the connections pool.
      Parameters:
        `maxPoolSize` - Maximum connection pool size
      Returns:
        this

    - #### validationQuery

          DataSourceBuilder.Builder validationQuery(String validationQuery)

      For connection pooling DataSources, set the connection validation query.
      Parameters:
        `validationQuery` - the connection validation query
      Returns:
        this

    - #### withInitScript

          DataSourceBuilder.Builder withInitScript(String sqlScript)

      Add a SQL intitialization script.

      Supported SQL scripts format:

      - The semicolon punctuation mark (`;`) must be used as SQL statements separator
      - Single line comments must be prefixed by `--`
      - Block comments must be delimited by `\*` and `*/`
      Parameters:
        `sqlScript` - SQL intitialization script (not null)
      Returns:
        this

    - #### withInitScriptResource

          DataSourceBuilder.Builder withInitScriptResource(String sqlScriptResourceName)

      Add a SQL intitialization script read from given classpath resource name (for example a file name). `ClassLoader.getResourceAsStream(String)` is used to load the resource, using the same conventions to locate the resource to load. UTF-8 is assumed as default encoding.

      Supported SQL scripts format:

      - The semicolon punctuation mark (`;`) must be used as SQL statements separator
      - Single line comments must be prefixed by `--`
      - Block comments must be delimited by `\*` and `*/`
      Parameters:
        `sqlScriptResourceName` - SQL script resource name
      Returns:
        this

    - #### build

          DataSource build()

      Build the `DataSource`.
      Returns:
        the `DataSource` instance
      Throws:
        `DataSourceInitializationException` - If a `DataSource` initialization error occurs, for example an error in SQL initialization scripts execution

Copyright © 2019 The Holon Platform. All rights reserved.