public interface JDBCDataSource extends Iterable<String>, Function<String,Connection>
DataSource
JDBCDataSources
Modifier and Type | Method and Description |
---|---|
default Connection |
apply(String schema)
Obtains a connection for the specified schema.
|
boolean |
authenticate(String username,
char[] password)
Authenticates the specified user against this data source.
|
Connection |
connection(String schema)
Provides a
Connection to the named schema, IFF the schema is available |
default Iterator<String> |
iterator() |
Iterable<String> |
schemas()
Enumerates the available JDBC schemas for a given
JDBCDataSource , to which a Connection may be opened |
static RuntimeException |
wrap(SQLException e) |
forEach, spliterator
default Connection apply(String schema) throws IllegalArgumentException, IllegalStateException, RuntimeException
apply
in interface Function<String,Connection>
IllegalArgumentException
- if the schema is not found. The cause is an SQLTransientConnectionException
with a SQL State of 08003
IllegalStateException
- if the connection creation was rejected by the server. The cause is an SQLTransientConnectionException
with a
SQL State of 08004
RuntimeException
- if the client cloud not connect to the server. The cause is an SQLTransientConnectionException
with a SQL
State of 08001
Connection connection(String schema) throws SchemaNotAvailableException, SQLException
Connection
to the named schema, IFF the schema is availableschema
- The name of the schema to connect toConnection
instance pointing to the schemaSchemaNotAvailableException
- if the requested schema does not exist or is not availableSQLException
- if an error occurs connecting to the requested schemaboolean authenticate(String username, char[] password)
username
- - the database userpassword
- - the passwordIterable<String> schemas() throws SQLException
JDBCDataSource
, to which a Connection
may be openedSQLException
- if an error occurs while processing this requeststatic RuntimeException wrap(SQLException e)