Skip navigation links

Oracle®Database JDBC Java API Reference
12c Release 1 (12.1.0.2)
E56669-01


oracle.jdbc.replay
Class OracleDataSourceImpl

java.lang.Object
  extended by oracle.jdbc.replay.OracleDataSourceImpl

All Implemented Interfaces:
Serializable, Wrapper, Referenceable, ObjectFactory, CommonDataSource, DataSource, OracleDataSource
Direct Known Subclasses:
OracleConnectionPoolDataSourceImpl

public class OracleDataSourceImpl
extends Object
implements oracle.jdbc.replay.internal.OracleDataSource, Serializable, Referenceable, ObjectFactory

JDBC Data Source that supports transparent JDBC operation replay upon a failover.

See Also:
Serialized Form

Field Summary
protected  oracle.jdbc.internal.OpaqueString password
           
protected  String user
           

 

Fields inherited from interface oracle.jdbc.replay.OracleDataSource
CONNECTION_PROPERTIES, DATA_SOURCE_NAME, DATABASE_NAME, DESCRIPTION, EXPLICIT_CACHING_ENABLED, IMPLICIT_CACHING_ENABLED, MAX_STATEMENTS, NETWORK_PROTOCOL, PASSWORD, PORT_NUMBER, ROLE_NAME, SERVER_NAME, URL, USER

 

Constructor Summary
OracleDataSourceImpl()
           

 

Method Summary
 void clearReplayStatistics()
          Clears replay statistics accumulated so far on all connection created by this data source.
 Connection getConnection()
           
 Connection getConnection(String username, String passwd)
          Attempts to obtain a database connection with the specified user and password.
 ConnectionInitializationCallback getConnectionInitializationCallback()
          Obtains the registered connection initialization callback, if any.
 Connection getConnectionNoProxy(String origUsr, String origPwd)
           
 Properties getConnectionProperties()
          Gets the connection properties that are set on this data source.
 String getConnectionProperty(String propertyName)
          Gets the specified connection property that are set on this data source.
 String getDatabaseName()
          Gets the database name.
 String getDataSourceName()
          Gets the data source name.
 String getDescription()
          Gets the data source description.
 boolean getExplicitCachingEnabled()
          Returns the current value of the explicitCachingEnabled property.
 boolean getImplicitCachingEnabled()
          getImplicitCachingEnabled Returns the current value of the implicitCachingEnabled property.
 int getLoginTimeout()
           
 PrintWriter getLogWriter()
           
 int getMaxStatements()
          Returns the current value of the maxStatements property.
 String getNetworkProtocol()
          Gets the datasource networkProtocol.
 Object getObjectInstance(Object refObj, Name name, Context nameCtx, Hashtable<?,?> env)
           
 Logger getParentLogger()
           
 int getPortNumber()
          Gets the database port number.
 oracle.jdbc.proxy.ProxyFactory getProxyFactory()
           
 Reference getReference()
           
 ReplayStatistics getReplayStatistics()
          Obtains replay statistics accumulated so far.
 String getRoleName()
          Gets the datasource role name.
 String getServerName()
          Gets the database server name.
 String getURL()
          Gets the URL for this data source.
 String getUser()
          Gets the user name for this data source.
 boolean isWrapperFor(Class<?> iface)
          Since this class is not a wrapper, just check to see if this implements the requested interface.
 void registerConnectionInitializationCallback(ConnectionInitializationCallback cbk)
          Registers a ConnectionInitializationCallback with the data source.
 void setConnectionProperties(Properties connProperties)
          Sets the connection properties on the data source.
 void setConnectionProperty(String name, String value)
          Sets a connection property on the data source.
 void setDatabaseName(String databaseName)
          Sets the database name.
 void setDataSourceName(String dataSourceName)
          Sets the data source name.
 void setDescription(String description)
          Sets the data source description.
 void setExplicitCachingEnabled(boolean cache)
          Sets the value of the explicitCachingEnabled property, which enables or disables the explicit cache.
 void setImplicitCachingEnabled(boolean cache)
          Sets the value of the implicitCachingEnabled property, which enables or disables the implicit statement cache.
 void setLoginTimeout(int seconds)
           
 void setLogWriter(PrintWriter out)
           
 void setMaxStatements(int max)
          Specifies the value of the maxStatements property.
 void setNetworkProtocol(String networkProtocol)
          Sets the datasource networkProtocol.
 void setPassword(String passwd)
          Sets the password with which connections have to be obtained.
 void setPortNumber(int portNumber)
          Sets the database port number.
 void setRoleName(String roleName)
          Sets the datasource role name.
 void setServerName(String serverName)
          Sets the database server name.
 void setURL(String url)
          Sets the URL that the data source uses to obtain connections to the database.
 void setUser(String username)
          Sets the user name with which connections have to be obtained.
 void unregisterConnectionInitializationCallback(ConnectionInitializationCallback cbk)
          Removes the ConnectionInitializationCallback registered with the data source, if any.
<T> T
unwrap(Class<T> iface)
          Since this class is not a wrapper, just check to see if this implements the requested interface.
 void updateReplayStatistics(oracle.jdbc.replay.internal.ReplayStatistics newStats)
          Updates replay statistics accumulated so far.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

user

protected String user

password

protected oracle.jdbc.internal.OpaqueString password

Constructor Detail

OracleDataSourceImpl

public OracleDataSourceImpl()

Method Detail

getConnection

public Connection getConnection()
                         throws SQLException
Specified by:
getConnection in interface DataSource
Throws:
SQLException

getConnection

public Connection getConnection(String username,
                                String passwd)
                         throws SQLException
Attempts to obtain a database connection with the specified user and password.
Specified by:
getConnection in interface DataSource
Parameters:
username - The database user on whose behalf the connection is being made.
passwd - The user's password.
Returns:
A Connection to the database.
Throws:
SQLException - if a database-access error occurs.

getConnectionNoProxy

public Connection getConnectionNoProxy(String origUsr,
                                       String origPwd)
                                throws SQLException
Throws:
SQLException

getLogWriter

public PrintWriter getLogWriter()
                         throws SQLException
Specified by:
getLogWriter in interface CommonDataSource
Throws:
SQLException

setLogWriter

public void setLogWriter(PrintWriter out)
                  throws SQLException
Specified by:
setLogWriter in interface CommonDataSource
Throws:
SQLException

setLoginTimeout

public void setLoginTimeout(int seconds)
                     throws SQLException
Specified by:
setLoginTimeout in interface CommonDataSource
Throws:
SQLException

getLoginTimeout

public int getLoginTimeout()
                    throws SQLException
Specified by:
getLoginTimeout in interface CommonDataSource
Throws:
SQLException

getUser

public String getUser()
Description copied from interface: OracleDataSource
Gets the user name for this data source.
Specified by:
getUser in interface OracleDataSource
Returns:
userName for this data source.

setUser

public void setUser(String username)
             throws SQLException
Description copied from interface: OracleDataSource
Sets the user name with which connections have to be obtained.
Specified by:
setUser in interface OracleDataSource
Parameters:
username - Username to be set.
Throws:
SQLException

setPassword

public void setPassword(String passwd)
                 throws SQLException
Description copied from interface: OracleDataSource
Sets the password with which connections have to be obtained.
Specified by:
setPassword in interface OracleDataSource
Parameters:
passwd - Passowrd to be set.
Throws:
SQLException

getURL

public String getURL()
Description copied from interface: OracleDataSource
Gets the URL for this data source.
Specified by:
getURL in interface OracleDataSource
Returns:
URL for this data source.

setURL

public void setURL(String url)
            throws SQLException
Description copied from interface: OracleDataSource
Sets the URL that the data source uses to obtain connections to the database.
Specified by:
setURL in interface OracleDataSource
Parameters:
url - URL to be set.
Throws:
SQLException

setServerName

public void setServerName(String serverName)
                   throws SQLException
Sets the database server name.
Specified by:
setServerName in interface OracleDataSource
Parameters:
serverName - Database server name to be set.
Throws:
SQLException

getServerName

public String getServerName()
Gets the database server name.
Specified by:
getServerName in interface OracleDataSource
Returns:
Database server name.

setPortNumber

public void setPortNumber(int portNumber)
                   throws SQLException
Sets the database port number.
Specified by:
setPortNumber in interface OracleDataSource
Parameters:
portNumber - Database port number to be set.
Throws:
SQLException

getPortNumber

public int getPortNumber()
Gets the database port number.
Specified by:
getPortNumber in interface OracleDataSource
Returns:
Database port number.

setDatabaseName

public void setDatabaseName(String databaseName)
                     throws SQLException
Sets the database name.
Specified by:
setDatabaseName in interface OracleDataSource
Parameters:
databaseName - Database name to be set.
Throws:
SQLException

getDatabaseName

public String getDatabaseName()
Gets the database name.
Specified by:
getDatabaseName in interface OracleDataSource
Returns:
Database name.

setDataSourceName

public void setDataSourceName(String dataSourceName)
                       throws SQLException
Sets the data source name.
Specified by:
setDataSourceName in interface OracleDataSource
Parameters:
dataSourceName - data source name to be set.
Throws:
SQLException

getDataSourceName

public String getDataSourceName()
Gets the data source name.
Specified by:
getDataSourceName in interface OracleDataSource
Returns:
data source name.

setDescription

public void setDescription(String description)
                    throws SQLException
Sets the data source description.
Specified by:
setDescription in interface OracleDataSource
Parameters:
description - data source description to be set.
Throws:
SQLException

getDescription

public String getDescription()
Gets the data source description.
Specified by:
getDescription in interface OracleDataSource
Returns:
data source description.

setNetworkProtocol

public void setNetworkProtocol(String networkProtocol)
                        throws SQLException
Sets the datasource networkProtocol.
Specified by:
setNetworkProtocol in interface OracleDataSource
Parameters:
networkProtocol - datasource networkProtocol to be set.
Throws:
SQLException

getNetworkProtocol

public String getNetworkProtocol()
Gets the datasource networkProtocol.
Specified by:
getNetworkProtocol in interface OracleDataSource
Returns:
datasource networkProtocol.

setRoleName

public void setRoleName(String roleName)
                 throws SQLException
Sets the datasource role name.
Specified by:
setRoleName in interface OracleDataSource
Parameters:
roleName - datasource role name to be set.
Throws:
SQLException

getRoleName

public String getRoleName()
Gets the datasource role name.
Specified by:
getRoleName in interface OracleDataSource
Returns:
datasource role name.

registerConnectionInitializationCallback

public void registerConnectionInitializationCallback(ConnectionInitializationCallback cbk)
                                              throws SQLException
Registers a ConnectionInitializationCallback with the data source.
Specified by:
registerConnectionInitializationCallback in interface OracleDataSource
Parameters:
cbk - The ConnectionInitializationCallback to be registered.
Throws:
SQLException - If the argument is null or callback registration fails.

unregisterConnectionInitializationCallback

public void unregisterConnectionInitializationCallback(ConnectionInitializationCallback cbk)
                                                throws SQLException
Removes the ConnectionInitializationCallback registered with the data source, if any.
Specified by:
unregisterConnectionInitializationCallback in interface OracleDataSource
Parameters:
cbk - The ConnectionInitializationCallback object to be unregistered.
Throws:
SQLException - If callback removal fails.

getConnectionInitializationCallback

public ConnectionInitializationCallback getConnectionInitializationCallback()
Description copied from interface: OracleDataSource
Obtains the registered connection initialization callback, if any.
Specified by:
getConnectionInitializationCallback in interface OracleDataSource
Returns:
The registered ConnectionInitializationCallback, or null if there is no callback registered.

getConnectionProperties

public Properties getConnectionProperties()
Gets the connection properties that are set on this data source.
Specified by:
getConnectionProperties in interface OracleDataSource
Returns:
Connection properties.

getConnectionProperty

public String getConnectionProperty(String propertyName)
Gets the specified connection property that are set on this data source.
Specified by:
getConnectionProperty in interface OracleDataSource
Parameters:
propertyName - The name of the specified property.
Returns:
The value of the inquired connection property. Null if the property is not set.

setConnectionProperty

public void setConnectionProperty(String name,
                                  String value)
                           throws SQLException
Sets a connection property on the data source.
Specified by:
setConnectionProperty in interface OracleDataSource
Parameters:
name - The name of the connection property to be set.
value - The value of the connection property to be set.
Throws:
SQLException - If any exception occurred while setting the connection property.
See Also:
setConnectionProperties

setConnectionProperties

public void setConnectionProperties(Properties connProperties)
                             throws SQLException
Sets the connection properties on the data source. The setting is not cumulative, so caller must provide all the properties to be set at once.
Specified by:
setConnectionProperties in interface OracleDataSource
Parameters:
connectionProperties - Connection properties to be set.
Throws:
SQLException - If any exception occurred while setting the connection properties.
See Also:
setConnectionFactoryProperties

setMaxStatements

public void setMaxStatements(int max)
                      throws SQLException
Specifies the value of the maxStatements property. This is the size of the statement cache used by both implicit and explicit caching. This value does not apply to the statement cache size of connections created by ImplicitStatementCache for which the cache size is set through a java.util.Properties object.
Specified by:
setMaxStatements in interface OracleDataSource
Parameters:
max - Requested size of the cache. If the existing cache size is less than max, statements will be purged to reduce the size.
Throws:
SQLException - if max < 0

getMaxStatements

public int getMaxStatements()
                     throws SQLException
Returns the current value of the maxStatements property.
Specified by:
getMaxStatements in interface OracleDataSource
Throws:
SQLException

setImplicitCachingEnabled

public void setImplicitCachingEnabled(boolean cache)
                               throws SQLException
Sets the value of the implicitCachingEnabled property, which enables or disables the implicit statement cache. Note that this is independent of the cache size that is set with setMaxStatements().
Specified by:
setImplicitCachingEnabled in interface OracleDataSource
Parameters:
cache - If true, then implicit caching is enabled. If false, then any existing statement is purged and the implicit caching is disabled.
Throws:
SQLException

getImplicitCachingEnabled

public boolean getImplicitCachingEnabled()
                                  throws SQLException
getImplicitCachingEnabled Returns the current value of the implicitCachingEnabled property.
Specified by:
getImplicitCachingEnabled in interface OracleDataSource
Throws:
SQLException

setExplicitCachingEnabled

public void setExplicitCachingEnabled(boolean cache)
                               throws SQLException
Sets the value of the explicitCachingEnabled property, which enables or disables the explicit cache. Note that this is independent of the cache size, which is set with setMaxStatements().
Specified by:
setExplicitCachingEnabled in interface OracleDataSource
Parameters:
cache - If true, then explicit caching is enabled. If false, then any existing statement is purged and the explicit caching is disabled.
Throws:
SQLException - if called on a logical connection.

getExplicitCachingEnabled

public boolean getExplicitCachingEnabled()
                                  throws SQLException
Returns the current value of the explicitCachingEnabled property.
Specified by:
getExplicitCachingEnabled in interface OracleDataSource
Throws:
SQLException

getReplayStatistics

public ReplayStatistics getReplayStatistics()
Description copied from interface: OracleDataSource
Obtains replay statistics accumulated so far. These reflect replay actions across all the connections created by this data source. It is recommended that this call be made when the connections are quiescent and there are few new connections being opened.
Specified by:
getReplayStatistics in interface OracleDataSource
Returns:
A replay statistics object containing all the metrics.

clearReplayStatistics

public void clearReplayStatistics()
Description copied from interface: OracleDataSource
Clears replay statistics accumulated so far on all connection created by this data source. It is recommended that this call be made when the connections are quiescent and there are few new connections being opened.
Specified by:
clearReplayStatistics in interface OracleDataSource

getReference

public Reference getReference()
                       throws NamingException
Specified by:
getReference in interface Referenceable
Throws:
NamingException

getObjectInstance

public Object getObjectInstance(Object refObj,
                                Name name,
                                Context nameCtx,
                                Hashtable<?,?> env)
                         throws Exception
Specified by:
getObjectInstance in interface ObjectFactory
Throws:
Exception

isWrapperFor

public boolean isWrapperFor(Class<?> iface)
                     throws SQLException
Since this class is not a wrapper, just check to see if this implements the requested interface.
Specified by:
isWrapperFor in interface Wrapper
Parameters:
iface - Requested interface.
Returns:
true If this implements the requested interface.
Throws:
SQLException - If the argument is not an interface.
Since:
JDBC 4.0

unwrap

public <T> T unwrap(Class<T> iface)
         throws SQLException
Since this class is not a wrapper, just check to see if this implements the requested interface.
Specified by:
unwrap in interface Wrapper
Parameters:
iface - Requested interface.
Returns:
this If this implements the requested interface.
Throws:
SQLException - If this does not implement the arg or the arg is not an interface.
Since:
JDBC 4.0

getParentLogger

public Logger getParentLogger()
                       throws SQLFeatureNotSupportedException
Throws:
SQLFeatureNotSupportedException

updateReplayStatistics

public void updateReplayStatistics(oracle.jdbc.replay.internal.ReplayStatistics newStats)
Description copied from interface: oracle.jdbc.replay.internal.OracleDataSource
Updates replay statistics accumulated so far. These reflect replay actions across all the connections created by this data source.
Parameters:
newStats - A new replay statistics object with updated metrics.

getProxyFactory

public oracle.jdbc.proxy.ProxyFactory getProxyFactory()
                                               throws SQLException
Throws:
SQLException

Skip navigation links

Oracle®Database JDBC Java API Reference
12c Release 1 (12.1.0.2)
E56669-01


Copyright © 2008, 2014, Oracle and/or its affiliates. All rights reserved.