public interface OracleConfigurationProvider
Using the Service Provider Interface (SPI) abstraction, the Oracle JDBC driver can be configured using a configuration service provider. This interface defines such a configuration service and can be implemented by a provider.
A custom JDBC URL can be used to make the driver load a specific configuration
provider. For example, jdbc:oracle:thin:@config-xyz://{parameters}
will make the driver attempt to load a provider of type "xyz".
The provider returns a Properties object that is applied to the
OracleCommonDataSource.setConnectionProperties(Properties)
using the same rules and priorities, except for the url value, that will
be applied with OracleCommonDataSource.setURL(String)
.
A property may be configured by different methods. For example, a
username can be set in the connection URL, or configured with the
"oracle.jdbc.user" property. The precedence of how properties are set is
defined in the JavaDoc of
CONNECTION_PROPERTY_CONFIG_FILE
.
Note: If your OracleConfigurationProvider
instance
requires caching capabilities, consider using
OracleConfigurationCachableProvider
interface for additional
caching behaviors.
The system property oracle.jdbc.configurationProviders can be used to indicate which configuration providers can be used by the driver. This value can be "(ALL)" (all providers are enabled) or "(NONE)" (all providers are disabled) or a comma-separated list of allowed providers names (case sensitive) between parenthesis. By default, all providers are enabled. The value is set to "(ALL)".
OracleConfigurationJsonSecretProvider
.OracleConfigurationJsonSecretProvider
.jdbc:oracle:thin:@config-file//:config.json
jdbc:oracle:thin:@config-https://myserver/config/myapp?key=dev
{ "connect_descriptor": "(description=(address_list=(address=(protocol=tcp) (host=myhost)(port=5521)))(connect_data=(service_name=myservice)))", "user": "scott", "password": { "type": "base64", "value": "dGlnZXI=" }, "wallet_location": { "type": "base64", "value": "bXl3YWxsZXRiaW5hcnlmaWxlCg==" }, "jdbc": { "autoCommit": "true" } }
{ "dev": { "connect_descriptor": "myhost:5521/myservice", "user": "scott", "password": { "type": "base64", "value": "dGlnZXI=" }, "jdbc": { "oracle.jdbc.ReadTimeout": 1000, "defaultRowPrefetch": 20, "autoCommit": "false" } } }
Modifier and Type | Field and Description |
---|---|
static java.util.Set<java.lang.String> |
allowedProviders |
Modifier and Type | Method and Description |
---|---|
static OracleConfigurationProvider |
find(java.lang.String providerType)
Helper method to retrieve a provider based on the type.
|
java.util.Properties |
getConnectionProperties(java.lang.String parameters)
Returns the Connection Properties configured in an external
provider.
|
java.lang.String |
getType()
Type of provider (eg: 'azure' for Azure App Configuration).
|
static java.util.Map<java.lang.String,java.lang.String> |
mapOptions(java.lang.String urlOptions)
Helper method to map options out of a url.
|
java.lang.String getType()
java.util.Properties getConnectionProperties(java.lang.String parameters) throws java.sql.SQLException
parameters
- used by the provider to retrieve the connection
properties. Eg: for the 'text' provider is a
location in the file system, for the 'http' is
a URL, for the 'azure' provider is the name of
the App Config followed by prefix of the keys
and an optional label. It is the responsibility
of the provider to specify its format.java.sql.SQLException
static OracleConfigurationProvider find(java.lang.String providerType)
providerType
- static java.util.Map<java.lang.String,java.lang.String> mapOptions(java.lang.String urlOptions)
urlOptions
- that contains key-value pairs separated by '&'.