@ThreadSafe public interface SqlService
Implementations of this service are expected to be thread-safe.
Modifier and Type | Method and Description |
---|---|
Optional<String> |
getConnectionUrlFromAlias(String alias)
Returns a possible connection URL for a given alias.
|
DataSource |
getDataSource(Object plugin,
String jdbcConnection)
Returns a data source for the provided JDBC connection string or an
alias.
|
DataSource |
getDataSource(String jdbcConnection)
Returns a data source for the provided JDBC connection string or
an alias.
|
DataSource getDataSource(String jdbcConnection) throws SQLException
A jdbc connection url is expected to be of the form: jdbc:<engine>://[<username>[:<password>]@]<host >/<database> or an alias (available aliases are known only by the service provider)
jdbcConnection
- The jdbc url or connection aliasSQLException
- if a connection to the given database could not
be establishedDataSource getDataSource(Object plugin, String jdbcConnection) throws SQLException
A jdbc connection url is expected to be of the form: jdbc:<engine>://[<username>[:<password>]@] <host>/<database> or an alias (available aliases are known only by the service provider)
plugin
- The plugin to lookup databases relative to (primarily
applying to file-backed databases)jdbcConnection
- The jdbc url or connection aliasSQLException
- if a connection to the given database could not
be establishedOptional<String> getConnectionUrlFromAlias(String alias)
alias
- The alias to checkOptional.empty()