Top Fields Constructors Methods
com.mysql.cj.jdbc.ha

public Class ReplicationMySQLConnection

extends MultiHostMySQLConnection
implements ReplicationConnection
Class Inheritance
All Implemented Interfaces
com.mysql.cj.jdbc.ha.ReplicationConnection, com.mysql.cj.jdbc.JdbcConnection, com.mysql.cj.TransactionEventHandler, com.mysql.cj.MysqlConnection, java.sql.Connection, java.lang.AutoCloseable, java.sql.Wrapper
Imports
java.sql.SQLException, java.util.Properties, java.util.concurrent.Executor, com.mysql.cj.Messages, com.mysql.cj.exceptions.MysqlErrorNumbers, com.mysql.cj.jdbc.JdbcConnection, com.mysql.cj.jdbc.exceptions.SQLError

Field Summary

Inherited from com.mysql.cj.jdbc.ha.MultiHostMySQLConnection:
thisAsProxy

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
abort(Executor
The Executor implementation which will be used by abort.
executor
)

Overrides com.mysql.cj.jdbc.ha.MultiHostMySQLConnection.abort.

Implements java.sql.Connection.abort.

Terminates an open connection.

public void
abortInternal()

Overrides com.mysql.cj.jdbc.ha.MultiHostMySQLConnection.abortInternal.

Implements com.mysql.cj.jdbc.JdbcConnection.abortInternal.

Clobbers the physical network connection and marks this connection as closed.

public void
public void
changeUser(String
the username to authenticate with
userName
,
String
the password to authenticate with
newPassword
)

Overrides com.mysql.cj.jdbc.ha.MultiHostMySQLConnection.changeUser.

Implements com.mysql.cj.jdbc.JdbcConnection.changeUser.

Changes the user on this connection by performing a re-authentication.

public JdbcConnection
public long
public JdbcConnection
public Properties
getProperties()

Overrides com.mysql.cj.jdbc.ha.MultiHostMySQLConnection.getProperties.

Implements com.mysql.cj.MysqlConnection.getProperties.

Returns the parsed and passed in properties for this connection.

public JdbcConnection
public JdbcConnection
public ReplicationConnectionProxy
private JdbcConnection
private JdbcConnection
public boolean
hasSameProperties(JdbcConnection
connection
c
)

Overrides com.mysql.cj.jdbc.ha.MultiHostMySQLConnection.hasSameProperties.

Implements com.mysql.cj.jdbc.JdbcConnection.hasSameProperties.

Does this connection have the same properties as another?

public boolean
public boolean
public boolean
isReadOnly()

Overrides com.mysql.cj.jdbc.ha.MultiHostMySQLConnection.isReadOnly.

Implements java.sql.Connection.isReadOnly.

Retrieves whether this Connection object is in read-only mode.

public boolean
isWrapperFor(Class<?>
a Class defining an interface.
iface
)

Overrides com.mysql.cj.jdbc.ha.MultiHostMySQLConnection.isWrapperFor.

Implements java.sql.Wrapper.isWrapperFor.

Returns true if this either implements the interface argument or is directly or indirectly a wrapper for an object that does.

public void
ping()

Overrides com.mysql.cj.jdbc.ha.MultiHostMySQLConnection.ping.

Implements com.mysql.cj.jdbc.JdbcConnection.ping.

Detect if the connection is still good by sending a ping command to the server.

public void
public void
public void
public void
public void
public void
public void
setReadOnly(boolean
true enables read-only mode; false disables it
readOnlyFlag
)

Overrides com.mysql.cj.jdbc.ha.MultiHostMySQLConnection.setReadOnly.

Implements java.sql.Connection.setReadOnly.

Puts this connection in read-only mode as a hint to the driver to enable database optimizations.

public void
setStatementComment(String
the comment that will be prepended to all statements sent to the server.
comment
)

Overrides com.mysql.cj.jdbc.ha.MultiHostMySQLConnection.setStatementComment.

Implements com.mysql.cj.jdbc.JdbcConnection.setStatementComment.

Sets the comment that will be prepended to all statements sent to the server.

public <T> T
unwrap(Class<T>
A Class defining an interface that the result must implement.
iface
)

Overrides com.mysql.cj.jdbc.ha.MultiHostMySQLConnection.unwrap.

Implements java.sql.Wrapper.unwrap.

Returns an object that implements the given interface to allow access to non-standard methods, or standard methods not exposed by the proxy.

Inherited from com.mysql.cj.jdbc.ha.MultiHostMySQLConnection:
checkClosedcleanupclearWarningsclientPrepareStatementclientPrepareStatementclientPrepareStatementclientPrepareStatementclientPrepareStatementclientPrepareStatementclosecommitcreateArrayOfcreateBlobcreateClobcreateNClobcreateNewIOcreateSQLXMLcreateStatementcreateStatementcreateStatementcreateStructdecachePreparedStatementdoClosegetActiveStatementCountgetAutoCommitgetAutoIncrementIncrementgetCachedMetaDatagetCataloggetCharacterSetMetadatagetClientInfogetClientInfogetClientInfoProviderImplgetConnectionLockgetDatabasegetExceptionInterceptorgetHoldabilitygetHostgetHostPortPairgetIdgetIdleForgetLockgetMetaDatagetMetadataSafeStatementgetMultiHostParentProxygetMultiHostSafeProxygetNetworkTimeoutgetPropertySetgetQueryInterceptorsInstancesgetSchemagetServerSessionStateControllergetServerVersiongetSessiongetSessionMaxRowsgetStatementCommentgetTransactionIsolationgetTypeMapgetURLgetUsergetWarningsinitializeResultsMetadataFromCacheinitializeSafeQueryInterceptorsisClosedisInGlobalTxisProxySetisReadOnlyisSameResourceisServerLocalisSourceConnectionisValidlowerCaseTableNamesnativeSQLpingInternalprepareCallprepareCallprepareCallprepareStatementprepareStatementprepareStatementprepareStatementprepareStatementprepareStatementrecachePreparedStatementregisterStatementreleaseSavepointresetServerStaterollbackrollbackserverPrepareStatementserverPrepareStatementserverPrepareStatementserverPrepareStatementserverPrepareStatementserverPrepareStatementsetAutoCommitsetCatalogsetClientInfosetClientInfosetDatabasesetFailedOversetHoldabilitysetInGlobalTxsetNetworkTimeoutsetReadOnlyInternalsetSavepointsetSavepointsetSchemasetSessionMaxRowssetTransactionIsolationsetTypeMapshutdownServerstoresLowerCaseTableNamethrowConnectionClosedExceptiontransactionBeguntransactionCompletedunregisterStatementunSafeQueryInterceptors

Constructor Detail

ReplicationMySQLConnectionback to summary
public ReplicationMySQLConnection(MultiHostConnectionProxy proxy)

Method Detail

abortback to summary
public void abort(Executor executor) throws SQLException

Overrides com.mysql.cj.jdbc.ha.MultiHostMySQLConnection.abort.

Implements java.sql.Connection.abort.

Doc from java.sql.Connection.abort.

Terminates an open connection. Calling abort results in:

  • The connection marked as closed
  • Closes any physical connection to the database
  • Releases resources used by the connection
  • Insures that any thread that is currently accessing the connection will either progress to completion or throw an SQLException.

Calling abort marks the connection closed and releases any resources. Calling abort on a closed connection is a no-op.

It is possible that the aborting and releasing of the resources that are held by the connection can take an extended period of time. When the abort method returns, the connection will have been marked as closed and the Executor that was passed as a parameter to abort may still be executing tasks to release resources.

Parameters
executor:Executor

The Executor implementation which will be used by abort.

Annotations
@Override
Exceptions
SQLException:
if a database access error occurs or the executor is null
abortInternalback to summary
public void abortInternal() throws SQLException

Overrides com.mysql.cj.jdbc.ha.MultiHostMySQLConnection.abortInternal.

Implements com.mysql.cj.jdbc.JdbcConnection.abortInternal.

Doc from com.mysql.cj.jdbc.JdbcConnection.abortInternal.

Clobbers the physical network connection and marks this connection as closed.

Annotations
@Override
Exceptions
SQLException:
if an error occurs
addReplicaHostback to summary
public void addReplicaHost(String host) throws SQLException

Implements com.mysql.cj.jdbc.ha.ReplicationConnection.addReplicaHost.

Annotations
@Override
changeUserback to summary
public void changeUser(String userName, String newPassword) throws SQLException

Overrides com.mysql.cj.jdbc.ha.MultiHostMySQLConnection.changeUser.

Implements com.mysql.cj.jdbc.JdbcConnection.changeUser.

Doc from com.mysql.cj.jdbc.JdbcConnection.changeUser.

Changes the user on this connection by performing a re-authentication. If authentication fails, the connection is failed.

Parameters
userName:String

the username to authenticate with

newPassword:String

the password to authenticate with

Annotations
@Override
Exceptions
SQLException:
if authentication fails, or some other error occurs while performing the command.
getActiveMySQLConnectionback to summary
public JdbcConnection getActiveMySQLConnection()

Overrides com.mysql.cj.jdbc.ha.MultiHostMySQLConnection.getActiveMySQLConnection.

Implements com.mysql.cj.jdbc.JdbcConnection.getActiveMySQLConnection.

Annotations
@Override
getConnectionGroupIdback to summary
public long getConnectionGroupId()

Implements com.mysql.cj.jdbc.ha.ReplicationConnection.getConnectionGroupId.

Annotations
@Override
getCurrentConnectionback to summary
public JdbcConnection getCurrentConnection()

Implements com.mysql.cj.jdbc.ha.ReplicationConnection.getCurrentConnection.

Annotations
@Override
getPropertiesback to summary
public Properties getProperties()

Overrides com.mysql.cj.jdbc.ha.MultiHostMySQLConnection.getProperties.

Implements com.mysql.cj.MysqlConnection.getProperties.

Doc from com.mysql.cj.MysqlConnection.getProperties.

Returns the parsed and passed in properties for this connection.

Returns:Properties

Properties

Annotations
@Override
getReplicaConnectionback to summary
public JdbcConnection getReplicaConnection()

Implements com.mysql.cj.jdbc.ha.ReplicationConnection.getReplicaConnection.

Annotations
@Override
getSourceConnectionback to summary
public JdbcConnection getSourceConnection()

Implements com.mysql.cj.jdbc.ha.ReplicationConnection.getSourceConnection.

Annotations
@Override
getThisAsProxyback to summary
public ReplicationConnectionProxy getThisAsProxy()

Overrides com.mysql.cj.jdbc.ha.MultiHostMySQLConnection.getThisAsProxy.

Annotations
@Override
getValidatedReplicasConnectionback to summary
private JdbcConnection getValidatedReplicasConnection()
getValidatedSourceConnectionback to summary
private JdbcConnection getValidatedSourceConnection()
hasSamePropertiesback to summary
public boolean hasSameProperties(JdbcConnection c)

Overrides com.mysql.cj.jdbc.ha.MultiHostMySQLConnection.hasSameProperties.

Implements com.mysql.cj.jdbc.JdbcConnection.hasSameProperties.

Doc from com.mysql.cj.jdbc.JdbcConnection.hasSameProperties.

Does this connection have the same properties as another?

Parameters
c:JdbcConnection

connection

Returns:boolean

true if has the same properties

Annotations
@Override
isHostReplicaback to summary
public boolean isHostReplica(String host)

Implements com.mysql.cj.jdbc.ha.ReplicationConnection.isHostReplica.

Annotations
@Override
isHostSourceback to summary
public boolean isHostSource(String host)

Implements com.mysql.cj.jdbc.ha.ReplicationConnection.isHostSource.

Annotations
@Override
isReadOnlyback to summary
public boolean isReadOnly() throws SQLException

Overrides com.mysql.cj.jdbc.ha.MultiHostMySQLConnection.isReadOnly.

Implements java.sql.Connection.isReadOnly.

Doc from java.sql.Connection.isReadOnly.

Retrieves whether this Connection object is in read-only mode.

Returns:boolean

true if this Connection object is read-only; false otherwise

Annotations
@Override
Exceptions
SQLException:
if a database access error occurs or this method is called on a closed connection
isWrapperForback to summary
public boolean isWrapperFor(Class<?> iface) throws SQLException

Overrides com.mysql.cj.jdbc.ha.MultiHostMySQLConnection.isWrapperFor.

Implements java.sql.Wrapper.isWrapperFor.

Doc from java.sql.Wrapper.isWrapperFor.

Returns true if this either implements the interface argument or is directly or indirectly a wrapper for an object that does. Returns false otherwise. If this implements the interface then return true, else if this is a wrapper then return the result of recursively calling isWrapperFor on the wrapped object. If this does not implement the interface and is not a wrapper, return false. This method should be implemented as a low-cost operation compared to unwrap so that callers can use this method to avoid expensive unwrap calls that may fail. If this method returns true then calling unwrap with the same argument should succeed.

Parameters
iface:Class<?>

a Class defining an interface.

Returns:boolean

true if this implements the interface or directly or indirectly wraps an object that does.

Annotations
@Override
Exceptions
SQLException:
if an error occurs while determining whether this is a wrapper for an object with the given interface.
pingback to summary
public void ping() throws SQLException

Overrides com.mysql.cj.jdbc.ha.MultiHostMySQLConnection.ping.

Implements com.mysql.cj.jdbc.JdbcConnection.ping.

Doc from com.mysql.cj.jdbc.JdbcConnection.ping.

Detect if the connection is still good by sending a ping command to the server.

Annotations
@Override
Exceptions
SQLException:
if the ping fails
promoteReplicaToSourceback to summary
public void promoteReplicaToSource(String host) throws SQLException

Implements com.mysql.cj.jdbc.ha.ReplicationConnection.promoteReplicaToSource.

Annotations
@Override
removeReplicaback to summary
public void removeReplica(String host) throws SQLException

Implements com.mysql.cj.jdbc.ha.ReplicationConnection.removeReplica.

Annotations
@Override
removeReplicaback to summary
public void removeReplica(String host, boolean closeGently) throws SQLException

Implements com.mysql.cj.jdbc.ha.ReplicationConnection.removeReplica.

Annotations
@Override
removeSourceHostback to summary
public void removeSourceHost(String host) throws SQLException

Implements com.mysql.cj.jdbc.ha.ReplicationConnection.removeSourceHost.

Annotations
@Override
removeSourceHostback to summary
public void removeSourceHost(String host, boolean waitUntilNotInUse) throws SQLException

Implements com.mysql.cj.jdbc.ha.ReplicationConnection.removeSourceHost.

Annotations
@Override
setProxyback to summary
public void setProxy(JdbcConnection proxy)

Overrides com.mysql.cj.jdbc.ha.MultiHostMySQLConnection.setProxy.

Implements com.mysql.cj.jdbc.JdbcConnection.setProxy.

Annotations
@Override
setReadOnlyback to summary
public void setReadOnly(boolean readOnlyFlag) throws SQLException

Overrides com.mysql.cj.jdbc.ha.MultiHostMySQLConnection.setReadOnly.

Implements java.sql.Connection.setReadOnly.

Doc from java.sql.Connection.setReadOnly.

Puts this connection in read-only mode as a hint to the driver to enable database optimizations.

Note

This method cannot be called during a transaction.

Parameters
readOnlyFlag:boolean

true enables read-only mode; false disables it

Annotations
@Override
Exceptions
SQLException:
if a database access error occurs, this method is called on a closed connection or this method is called during a transaction
setStatementCommentback to summary
public void setStatementComment(String comment)

Overrides com.mysql.cj.jdbc.ha.MultiHostMySQLConnection.setStatementComment.

Implements com.mysql.cj.jdbc.JdbcConnection.setStatementComment.

Doc from com.mysql.cj.jdbc.JdbcConnection.setStatementComment.

Sets the comment that will be prepended to all statements sent to the server. Do not use slash-star or star-slash tokens in the comment as these will be added by the driver itself.

Parameters
comment:String

the comment that will be prepended to all statements sent to the server.

Annotations
@Override
unwrapback to summary
public <T> T unwrap(Class<T> iface) throws SQLException

Overrides com.mysql.cj.jdbc.ha.MultiHostMySQLConnection.unwrap.

Implements java.sql.Wrapper.unwrap.

Doc from java.sql.Wrapper.unwrap.

Returns an object that implements the given interface to allow access to non-standard methods, or standard methods not exposed by the proxy. If the receiver implements the interface then the result is the receiver or a proxy for the receiver. If the receiver is a wrapper and the wrapped object implements the interface then the result is the wrapped object or a proxy for the wrapped object. Otherwise return the the result of calling unwrap recursively on the wrapped object or a proxy for that result. If the receiver is not a wrapper and does not implement the interface, then an SQLException is thrown.

Parameters
<T>
the type of the class modeled by this Class object
iface:Class<T>

A Class defining an interface that the result must implement.

Returns:T

an object that implements the interface. May be a proxy for the actual implementing object.

Annotations
@Override
Exceptions
SQLException:
If no object found that implements the interface