Package oracle.dbtools.plugin.api.jdbc

## Interface JDBCDataSource

- All Superinterfaces:
    `java.util.function.Function<java.lang.String,​java.sql.Connection>`, `java.lang.Iterable<java.lang.String>`

      public interface JDBCDataSource
      extends java.lang.Iterable<java.lang.String>, java.util.function.Function<java.lang.String,​java.sql.Connection>

  Provides information about a `DataSource`
  Author:
    cdivilly
  See Also:
    `JDBCDataSources`

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `default java.sql.Connection` | `apply​(java.lang.String schema)` | Obtains a connection for the specified schema.
    `boolean` | `authenticate​(java.lang.String username, char[] password)` | Authenticates the specified user against this data source.
    `java.sql.Connection` | `connection​(java.lang.String schema)` | Provides a `Connection` to the named schema, IFF the schema is available
    `default java.util.Iterator<java.lang.String>` | `iterator()` |
    `java.lang.Iterable<java.lang.String>` | `schemas()` | Enumerates the available JDBC schemas for a given `JDBCDataSource`, to which a `Connection` may be opened
    `static java.lang.RuntimeException` | `wrap​(java.sql.SQLException e)` |

    - ### Methods inherited from interface java.util.function.Function

      `andThen, compose`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, spliterator`

- - ### Method Detail

    - #### apply

          default java.sql.Connection apply​(java.lang.String schema)
                                     throws java.lang.IllegalArgumentException,
                                            java.lang.IllegalStateException,
                                            java.lang.RuntimeException

      Obtains a connection for the specified schema.
      Specified by:
        `apply` in interface `java.util.function.Function<java.lang.String,​java.sql.Connection>`
      Returns:
        the connection if available
      Throws:
        `java.lang.IllegalArgumentException` - if the schema is not found. The cause is an `SQLTransientConnectionException` with a SQL State of `08003`
        `java.lang.IllegalStateException` - if the connection creation was rejected by the server. The cause is an `SQLTransientConnectionException` with a SQL State of `08004`
        `java.lang.RuntimeException` - if the client cloud not connect to the server. The cause is an `SQLTransientConnectionException` with a SQL State of `08001`

    - #### connection

          java.sql.Connection connection​(java.lang.String schema)
                                  throws SchemaNotAvailableException,
                                         java.sql.SQLException

      Provides a `Connection` to the named schema, IFF the schema is available
      Parameters:
        `schema` - The name of the schema to connect to
      Returns:
        `Connection` instance pointing to the schema
      Throws:
        `SchemaNotAvailableException` - if the requested schema does not exist or is not available
        `java.sql.SQLException` - if an error occurs connecting to the requested schema

    - #### authenticate

          boolean authenticate​(java.lang.String username,
                               char[] password)

      Authenticates the specified user against this data source.
      Parameters:
        `username` - - the database user
        `password` - - the password
      Returns:
        true if the authentication is successful

    - #### iterator

          default java.util.Iterator<java.lang.String> iterator()

      Specified by:
        `iterator` in interface `java.lang.Iterable<java.lang.String>`

    - #### schemas

          java.lang.Iterable<java.lang.String> schemas()
                                                throws java.sql.SQLException

      Enumerates the available JDBC schemas for a given `JDBCDataSource`, to which a `Connection` may be opened
      Returns:
        Set of schema names
      Throws:
        `java.sql.SQLException` - if an error occurs while processing this request

    - #### wrap

          static java.lang.RuntimeException wrap​(java.sql.SQLException e)