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 aDataSource
- 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 aConnection
to the named schema, IFF the schema is availabledefault java.util.Iterator<java.lang.String>
iterator()
java.lang.Iterable<java.lang.String>
schemas()
Enumerates the available JDBC schemas for a givenJDBCDataSource
, to which aConnection
may be openedstatic java.lang.RuntimeException
wrap(java.sql.SQLException e)
-
-
-
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 interfacejava.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 anSQLTransientConnectionException
with a SQL State of08003
java.lang.IllegalStateException
- if the connection creation was rejected by the server. The cause is anSQLTransientConnectionException
with a SQL State of08004
java.lang.RuntimeException
- if the client cloud not connect to the server. The cause is anSQLTransientConnectionException
with a SQL State of08001
-
connection
java.sql.Connection connection(java.lang.String schema) throws SchemaNotAvailableException, java.sql.SQLException
Provides aConnection
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 availablejava.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 userpassword
- - the password- Returns:
- true if the authentication is successful
-
iterator
default java.util.Iterator<java.lang.String> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<java.lang.String>
-
schemas
java.lang.Iterable<java.lang.String> schemas() throws java.sql.SQLException
Enumerates the available JDBC schemas for a givenJDBCDataSource
, to which aConnection
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)
-
-