public interface OracleCommonDataSource
extends javax.sql.CommonDataSource
OracleDataSource
, OracleXADataSource
and
OracleConnectionPoolDataSource
and defines the Oracle extensions
to the standard JDBC interface CommonDataSource
.Modifier and Type | Method and Description |
---|---|
default OracleShardingKeyBuilder |
createShardingKeyBuilder()
Creates a new
OracleShardingKeyBuilder instance. |
java.util.Properties |
getConnectionProperties()
Gets the connection properties that are set on this data source object.
|
java.lang.String |
getConnectionProperty(java.lang.String propertyName)
Gets the specified connection property that is set on this data source.
|
java.lang.String |
getDatabaseName()
Gets the name of the database set on this DataSource instance.
|
java.lang.String |
getDataSourceName()
Gets the datasource name for this instance if set.
|
java.lang.String |
getDescription()
Get the Description of this data source.
|
boolean |
getExplicitCachingEnabled()
Returns the current value of the explicitCachingEnabled property.
|
boolean |
getImplicitCachingEnabled()
getImplicitCachingEnabled
Returns the current value of the implicitCachingEnabled property.
|
int |
getMaxStatements()
Returns the current value of the maxStatements property.
|
java.lang.String |
getNetworkProtocol()
Gets the network protocol set on the datasource.
|
int |
getPortNumber()
Gets the port number on which server is listening for requests.
|
java.lang.String |
getRoleName()
Gets the data source role name.
|
java.lang.String |
getServerName()
Gets the name of the server on which database is running.
|
java.lang.String |
getURL()
Gets the URL for this datasource.
|
java.lang.String |
getUser()
Gets the user name for this datasource.
|
void |
setConnectionProperties(java.util.Properties value)
Sets the Connection Properties for the datasource
|
void |
setConnectionProperty(java.lang.String name,
java.lang.String value)
Sets a connection property on the data source.
|
void |
setDatabaseName(java.lang.String dbname)
Sets the name of a particular database on a server.
|
void |
setDataSourceName(java.lang.String dsname)
Sets the datasource name.
|
void |
setDescription(java.lang.String des)
Sets the Description for this data source instance.
|
void |
setExplicitCachingEnabled(boolean cache)
Sets the value of the explicitCachingEnabled property, which
enables or disables the explicit cache.
|
void |
setHostnameResolver(OracleHostnameResolver hostnameResolver)
Sets a custom hostname resolver implementing
OracleHostnameResolver
used to provide a custom DNS name resolution strategy to locate the database host. |
void |
setImplicitCachingEnabled(boolean cache)
Sets the value of the implicitCachingEnabled property, which
enables or disables the implicit statement cache.
|
void |
setMaxStatements(int max)
Specifies the value of the maxStatements property.
|
void |
setNetworkProtocol(java.lang.String np)
Sets the network protocol for the connections.
|
void |
setPassword(java.lang.String pd)
Sets the password with which connections have to be obtained.
|
void |
setPortNumber(int pn)
Sets the port number where a server is listening for requests.
|
void |
setRoleName(java.lang.String roleName)
Sets the data source role name.
|
void |
setServerName(java.lang.String sn)
Sets the name of the Server on which database is running.
|
void |
setSingleShardTransactionSupport(boolean allow)
Sets single shard transaction support in auto commit OFF mode.
|
void |
setSSLContext(javax.net.ssl.SSLContext sslContext)
Specifies a
SSLContext to use as a factory for
SSLEngine objects that carry out the TLS
protocol. |
void |
setTokenSupplier(java.util.function.Supplier<? extends AccessToken> tokenSupplier)
Sets a supplier function that generates an access token when creating a
connection with this
DataSource . |
void |
setURL(java.lang.String url)
Sets the URL from which connections have to be obtained.
|
void |
setUser(java.lang.String userName)
Set the user name with which connections have to be obtained.
|
default OracleShardingKeyBuilder createShardingKeyBuilder() throws java.sql.SQLException
OracleShardingKeyBuilder
instance.java.sql.SQLException
- if an error occurs creating the builderOracleShardingKeyBuilder
void setDataSourceName(java.lang.String dsname) throws java.sql.SQLException
dsname
- DataSource Name to be set.java.sql.SQLException
java.lang.String getDataSourceName()
java.lang.String getDatabaseName()
void setDatabaseName(java.lang.String dbname) throws java.sql.SQLException
If URL is set, this property will be ignored.
dsname
- database name to be set.java.sql.SQLException
void setServerName(java.lang.String sn) throws java.sql.SQLException
sn
- server/host name to be set.java.sql.SQLException
java.lang.String getServerName()
void setURL(java.lang.String url) throws java.sql.SQLException
url
- URL to be set.java.sql.SQLException
java.lang.String getURL() throws java.sql.SQLException
java.sql.SQLException
void setUser(java.lang.String userName) throws java.sql.SQLException
user
- Username to be set.java.sql.SQLException
java.lang.String getUser()
void setPassword(java.lang.String pd) throws java.sql.SQLException
pd
- Password to be set.java.sql.SQLException
java.lang.String getDescription()
void setDescription(java.lang.String des) throws java.sql.SQLException
des
- Description to be set.java.sql.SQLException
java.lang.String getNetworkProtocol()
void setNetworkProtocol(java.lang.String np) throws java.sql.SQLException
np
- set the network protocol to be used.java.sql.SQLException
void setPortNumber(int pn) throws java.sql.SQLException
pn
- port number on which server is listeningjava.sql.SQLException
int getPortNumber()
void setConnectionProperties(java.util.Properties value) throws java.sql.SQLException
The argument to this method is a Properties object. This properties object is used to create the connections returned by the receiver. The keys and values are Strings. The keys, values, and their meanings are defined in oracle.jdbc.OracleConnection.
value
- a Properties object with the desired connection property names
and values.java.sql.SQLException
OracleConnection
java.util.Properties getConnectionProperties() throws java.sql.SQLException
java.sql.SQLException
- If any exception occurs while getting the connection
properties.void setConnectionProperty(java.lang.String name, java.lang.String value) throws java.sql.SQLException
name
- The name of the connection property to be set.value
- The value of the connection property to be set.java.sql.SQLException
- If any exception occurred while setting the connection
property.setConnectionProperties
,
OracleConnection
java.lang.String getConnectionProperty(java.lang.String propertyName) throws java.sql.SQLException
propertyName
- The name of the specified connection property.java.sql.SQLException
- If any exception occurs while getting the connection
property.void setMaxStatements(int max) throws java.sql.SQLException
max
- Requested size of the cache. If the existing cache size
is less than max, statements will be purged to reduce the
size.java.sql.SQLException
- if max < 0int getMaxStatements() throws java.sql.SQLException
java.sql.SQLException
void setImplicitCachingEnabled(boolean cache) throws java.sql.SQLException
cache
- If true, then implicit caching is enabled. If false,
then any existing statement is purged and the implicit
caching is disabled.java.sql.SQLException
boolean getImplicitCachingEnabled() throws java.sql.SQLException
java.sql.SQLException
void setExplicitCachingEnabled(boolean cache) throws java.sql.SQLException
cache
- If true, then explicit caching is enabled. If false,
then any existing statement is purged and the explicit
caching is disabled.java.sql.SQLException
- if called on a logical connection.boolean getExplicitCachingEnabled() throws java.sql.SQLException
java.sql.SQLException
void setRoleName(java.lang.String roleName) throws java.sql.SQLException
roleName
- data source role name to be set.java.sql.SQLException
java.lang.String getRoleName()
void setSSLContext(javax.net.ssl.SSLContext sslContext) throws java.sql.SQLException
Specifies a SSLContext
to use as a factory for
SSLEngine objects that carry out the TLS
protocol.
The SSLContext must be initialized before establishing a connection with this data source. The certificates specified by that initialization will be used in place of any connection properties that would otherwise have specified certificates, such as key store and trust store property values.
Specifying a null value will clear any non-null SSLContext
previously set by this method
sslContext
- An SSLContext to use as an SSLEngine factory. May be
null.java.sql.SQLException
- if this data source is incompatible with the
specified SSLContext.void setSingleShardTransactionSupport(boolean allow) throws java.sql.SQLException
allow
- java.sql.SQLException
void setHostnameResolver(OracleHostnameResolver hostnameResolver)
OracleHostnameResolver
used to provide a custom DNS name resolution strategy to locate the database host.hostnameResolver
- an OracleHostnameResolver to use when resolving the
datasource hostnamevoid setTokenSupplier(java.util.function.Supplier<? extends AccessToken> tokenSupplier)
Sets a supplier function that generates an access token when creating a
connection with this DataSource
. The supplier function
is invoked each time this DataSource
creates a
connection. Instances of AccessToken
that are output by the
supplier must represent a token type that is supported by Oracle Database
for client authentication. The supplier must be thread safe.
It is invalid to configure this DataSource
with both a token
supplier and with a user name or password. If invocations of
setUser(String)
, setPassword(String)
,
setConnectionProperties(java.util.Properties)
, or
setConnectionProperty(String, String)
have configured this
DataSource
with a user name or password, and an invocation of
this method has also configured a token supplier, then a
SQLException
indicating an invalid configuration is thrown when
creating a connection with this datasource.
Note that AccessToken.createJsonWebTokenCache(Supplier)
can be
called to create a thread safe Supplier
that caches tokens from
a user defined Supplier
.
tokenSupplier
- Token supplying function. Not null
.java.lang.NullPointerException
- If the tokenSupplier
is null.