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.Connectionapply(java.lang.String schema)Obtains a connection for the specified schema.booleanauthenticate(java.lang.String username, char[] password)Authenticates the specified user against this data source.java.sql.Connectionconnection(java.lang.String schema)Provides aConnectionto the named schema, IFF the schema is availabledefault HostContexthostContext()Provides information about the host such as the hostname, the location of the host file and the last modified time.default java.util.Iterator<java.lang.String>iterator()java.lang.Iterable<java.lang.String>schemas()Enumerates the available JDBC schemas for a givenJDBCDataSource, to which aConnectionmay be openedjava.lang.StringserviceID()Retrieve the service identification.static java.lang.RuntimeExceptionwrap(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.RuntimeExceptionObtains a connection for the specified schema.- Specified by:
applyin 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 anSQLTransientConnectionExceptionwith a SQL State of08003java.lang.IllegalStateException- if the connection creation was rejected by the server. The cause is anSQLTransientConnectionExceptionwith a SQL State of08004java.lang.RuntimeException- if the client cloud not connect to the server. The cause is anSQLTransientConnectionExceptionwith a SQL State of08001
-
connection
java.sql.Connection connection(java.lang.String schema) throws SchemaNotAvailableException, java.sql.SQLExceptionProvides aConnectionto the named schema, IFF the schema is available- Parameters:
schema- The name of the schema to connect to- Returns:
Connectioninstance 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
-
hostContext
default HostContext hostContext()
Provides information about the host such as the hostname, the location of the host file and the last modified time.- Returns:
HostContext
-
serviceID
java.lang.String serviceID()
Retrieve the service identification.- Returns:
- service id
-
iterator
default java.util.Iterator<java.lang.String> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<java.lang.String>
-
schemas
java.lang.Iterable<java.lang.String> schemas() throws java.sql.SQLExceptionEnumerates the available JDBC schemas for a givenJDBCDataSource, to which aConnectionmay 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)
-
-