类 ReplicationMySQLConnection
- java.lang.Object
-
- com.mysql.cj.jdbc.ha.MultiHostMySQLConnection
-
- com.mysql.cj.jdbc.ha.ReplicationMySQLConnection
-
- 所有已实现的接口:
ReplicationConnection,JdbcConnection,MysqlConnection,TransactionEventHandler,AutoCloseable,Connection,Wrapper
public class ReplicationMySQLConnection extends MultiHostMySQLConnection implements ReplicationConnection
-
-
字段概要
-
从类继承的字段 com.mysql.cj.jdbc.ha.MultiHostMySQLConnection
thisAsProxy
-
-
构造器概要
构造器 构造器 说明 ReplicationMySQLConnection(MultiHostConnectionProxy proxy)
-
方法概要
所有方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 voidabort(Executor executor)voidabortInternal()Clobbers the physical network connection and marks this connection as closed.voidaddReplicaHost(String host)voidchangeUser(String userName, String newPassword)Changes the user on this connection by performing a re-authentication.voidclearHasTriedMaster()已过时。JdbcConnectiongetActiveMySQLConnection()longgetConnectionGroupId()JdbcConnectiongetCurrentConnection()PropertiesgetProperties()Returns the parsed and passed in properties for this connection.JdbcConnectiongetReplicaConnection()JdbcConnectiongetSourceConnection()ReplicationConnectionProxygetThisAsProxy()booleanhasSameProperties(JdbcConnection c)Does this connection have the same properties as another?booleanisHostReplica(String host)booleanisHostSource(String host)booleanisReadOnly()booleanisWrapperFor(Class<?> iface)voidping()Detect if the connection is still good by sending a ping command to the server.voidpromoteReplicaToSource(String host)voidremoveReplica(String host)voidremoveReplica(String host, boolean closeGently)voidremoveSourceHost(String host)voidremoveSourceHost(String host, boolean waitUntilNotInUse)voidsetProxy(JdbcConnection proxy)voidsetReadOnly(boolean readOnlyFlag)voidsetStatementComment(String comment)Sets the comment that will be prepended to all statements sent to the server.<T> Tunwrap(Class<T> iface)-
从类继承的方法 com.mysql.cj.jdbc.ha.MultiHostMySQLConnection
checkClosed, cleanup, clearWarnings, clientPrepareStatement, clientPrepareStatement, clientPrepareStatement, clientPrepareStatement, clientPrepareStatement, clientPrepareStatement, close, commit, createArrayOf, createBlob, createClob, createNClob, createNewIO, createSQLXML, createStatement, createStatement, createStatement, createStruct, decachePreparedStatement, getActiveStatementCount, getAutoCommit, getAutoIncrementIncrement, getCachedMetaData, getCatalog, getCharacterSetMetadata, getClientInfo, getClientInfo, getClientInfoProviderImpl, getConnectionMutex, getDatabase, getExceptionInterceptor, getHoldability, getHost, getHostPortPair, getId, getIdleFor, getMetaData, getMetadataSafeStatement, getMultiHostParentProxy, getMultiHostSafeProxy, getNetworkTimeout, getPropertySet, getQueryInterceptorsInstances, getSchema, getServerSessionStateController, getServerVersion, getSession, getSessionMaxRows, getStatementComment, getTransactionIsolation, getTypeMap, getURL, getUser, getWarnings, hasTriedMaster, initializeResultsMetadataFromCache, initializeSafeQueryInterceptors, isClosed, isInGlobalTx, isProxySet, isReadOnly, isSameResource, isServerLocal, isSourceConnection, isValid, lowerCaseTableNames, nativeSQL, normalClose, pingInternal, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, realClose, recachePreparedStatement, registerStatement, releaseSavepoint, resetServerState, rollback, rollback, serverPrepareStatement, serverPrepareStatement, serverPrepareStatement, serverPrepareStatement, serverPrepareStatement, serverPrepareStatement, setAutoCommit, setCatalog, setClientInfo, setClientInfo, setDatabase, setFailedOver, setHoldability, setInGlobalTx, setNetworkTimeout, setReadOnlyInternal, setSavepoint, setSavepoint, setSchema, setSessionMaxRows, setTransactionIsolation, setTypeMap, shutdownServer, storesLowerCaseTableName, throwConnectionClosedException, transactionBegun, transactionCompleted, unregisterStatement, unSafeQueryInterceptors
-
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
从接口继承的方法 java.sql.Connection
beginRequest, clearWarnings, close, commit, createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStatement, createStatement, createStatement, createStruct, endRequest, getAutoCommit, getCatalog, getClientInfo, getClientInfo, getHoldability, getMetaData, getNetworkTimeout, getSchema, getTransactionIsolation, getTypeMap, getWarnings, isClosed, isValid, nativeSQL, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, rollback, setAutoCommit, setCatalog, setClientInfo, setClientInfo, setHoldability, setNetworkTimeout, setSavepoint, setSavepoint, setSchema, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid, setTransactionIsolation, setTypeMap
-
从接口继承的方法 com.mysql.cj.jdbc.JdbcConnection
clientPrepareStatement, clientPrepareStatement, clientPrepareStatement, clientPrepareStatement, clientPrepareStatement, clientPrepareStatement, decachePreparedStatement, getActiveStatementCount, getAutoIncrementIncrement, getCachedMetaData, getCharacterSetMetadata, getClientInfoProviderImpl, getDatabase, getHost, getHostPortPair, getIdleFor, getMetadataSafeStatement, getMultiHostParentProxy, getMultiHostSafeProxy, getPropertySet, getQueryInterceptorsInstances, getServerVersion, getSessionMaxRows, getStatementComment, hasTriedMaster, initializeResultsMetadataFromCache, initializeSafeQueryInterceptors, isInGlobalTx, isMasterConnection, isProxySet, isReadOnly, isSameResource, isServerLocal, isSourceConnection, lowerCaseTableNames, pingInternal, realClose, recachePreparedStatement, registerStatement, resetServerState, serverPrepareStatement, serverPrepareStatement, serverPrepareStatement, serverPrepareStatement, serverPrepareStatement, serverPrepareStatement, setDatabase, setFailedOver, setInGlobalTx, setReadOnlyInternal, setSessionMaxRows, shutdownServer, storesLowerCaseTableName, throwConnectionClosedException, unregisterStatement, unSafeQueryInterceptors
-
从接口继承的方法 com.mysql.cj.MysqlConnection
checkClosed, cleanup, createNewIO, getConnectionMutex, getExceptionInterceptor, getId, getServerSessionStateController, getSession, getURL, getUser, normalClose
-
从接口继承的方法 com.mysql.cj.jdbc.ha.ReplicationConnection
addSlaveHost, getMasterConnection, getSlavesConnection, isHostMaster, isHostSlave, promoteSlaveToMaster, removeMasterHost, removeMasterHost, removeSlave, removeSlave
-
从接口继承的方法 com.mysql.cj.TransactionEventHandler
transactionBegun, transactionCompleted
-
-
-
-
构造器详细资料
-
ReplicationMySQLConnection
public ReplicationMySQLConnection(MultiHostConnectionProxy proxy)
-
-
方法详细资料
-
getThisAsProxy
public ReplicationConnectionProxy getThisAsProxy()
-
getActiveMySQLConnection
public JdbcConnection getActiveMySQLConnection()
-
getCurrentConnection
public JdbcConnection getCurrentConnection()
- 指定者:
getCurrentConnection在接口中ReplicationConnection
-
getConnectionGroupId
public long getConnectionGroupId()
- 指定者:
getConnectionGroupId在接口中ReplicationConnection
-
getSourceConnection
public JdbcConnection getSourceConnection()
- 指定者:
getSourceConnection在接口中ReplicationConnection
-
promoteReplicaToSource
public void promoteReplicaToSource(String host) throws SQLException
- 指定者:
promoteReplicaToSource在接口中ReplicationConnection- 抛出:
SQLException
-
removeSourceHost
public void removeSourceHost(String host) throws SQLException
- 指定者:
removeSourceHost在接口中ReplicationConnection- 抛出:
SQLException
-
removeSourceHost
public void removeSourceHost(String host, boolean waitUntilNotInUse) throws SQLException
- 指定者:
removeSourceHost在接口中ReplicationConnection- 抛出:
SQLException
-
isHostSource
public boolean isHostSource(String host)
- 指定者:
isHostSource在接口中ReplicationConnection
-
getReplicaConnection
public JdbcConnection getReplicaConnection()
- 指定者:
getReplicaConnection在接口中ReplicationConnection
-
addReplicaHost
public void addReplicaHost(String host) throws SQLException
- 指定者:
addReplicaHost在接口中ReplicationConnection- 抛出:
SQLException
-
removeReplica
public void removeReplica(String host) throws SQLException
- 指定者:
removeReplica在接口中ReplicationConnection- 抛出:
SQLException
-
removeReplica
public void removeReplica(String host, boolean closeGently) throws SQLException
- 指定者:
removeReplica在接口中ReplicationConnection- 抛出:
SQLException
-
isHostReplica
public boolean isHostReplica(String host)
- 指定者:
isHostReplica在接口中ReplicationConnection
-
setReadOnly
public void setReadOnly(boolean readOnlyFlag) throws SQLException- 指定者:
setReadOnly在接口中Connection- 覆盖:
setReadOnly在类中MultiHostMySQLConnection- 抛出:
SQLException
-
isReadOnly
public boolean isReadOnly() throws SQLException- 指定者:
isReadOnly在接口中Connection- 覆盖:
isReadOnly在类中MultiHostMySQLConnection- 抛出:
SQLException
-
ping
public void ping() throws SQLException从接口复制的说明:JdbcConnectionDetect if the connection is still good by sending a ping command to the server.- 指定者:
ping在接口中JdbcConnection- 覆盖:
ping在类中MultiHostMySQLConnection- 抛出:
SQLException- if the ping fails
-
changeUser
public void changeUser(String userName, String newPassword) throws SQLException
从接口复制的说明:JdbcConnectionChanges the user on this connection by performing a re-authentication. If authentication fails, the connection is failed.- 指定者:
changeUser在接口中JdbcConnection- 覆盖:
changeUser在类中MultiHostMySQLConnection- 参数:
userName- the username to authenticate withnewPassword- the password to authenticate with- 抛出:
SQLException- if authentication fails, or some other error occurs while performing the command.
-
setStatementComment
public void setStatementComment(String comment)
从接口复制的说明:JdbcConnectionSets 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.- 指定者:
setStatementComment在接口中JdbcConnection- 覆盖:
setStatementComment在类中MultiHostMySQLConnection- 参数:
comment- the comment that will be prepended to all statements sent to the server.
-
hasSameProperties
public boolean hasSameProperties(JdbcConnection c)
从接口复制的说明:JdbcConnectionDoes this connection have the same properties as another?- 指定者:
hasSameProperties在接口中JdbcConnection- 覆盖:
hasSameProperties在类中MultiHostMySQLConnection- 参数:
c- connection- 返回:
- true if has the same properties
-
getProperties
public Properties getProperties()
从接口复制的说明:MysqlConnectionReturns the parsed and passed in properties for this connection.- 指定者:
getProperties在接口中MysqlConnection- 覆盖:
getProperties在类中MultiHostMySQLConnection- 返回:
Properties
-
abort
public void abort(Executor executor) throws SQLException
- 指定者:
abort在接口中Connection- 覆盖:
abort在类中MultiHostMySQLConnection- 抛出:
SQLException
-
abortInternal
public void abortInternal() throws SQLException从接口复制的说明:JdbcConnectionClobbers the physical network connection and marks this connection as closed.- 指定者:
abortInternal在接口中JdbcConnection- 覆盖:
abortInternal在类中MultiHostMySQLConnection- 抛出:
SQLException- if an error occurs
-
setProxy
public void setProxy(JdbcConnection proxy)
- 指定者:
setProxy在接口中JdbcConnection- 覆盖:
setProxy在类中MultiHostMySQLConnection
-
isWrapperFor
public boolean isWrapperFor(Class<?> iface) throws SQLException
- 指定者:
isWrapperFor在接口中Wrapper- 覆盖:
isWrapperFor在类中MultiHostMySQLConnection- 抛出:
SQLException
-
unwrap
public <T> T unwrap(Class<T> iface) throws SQLException
- 指定者:
unwrap在接口中Wrapper- 覆盖:
unwrap在类中MultiHostMySQLConnection- 抛出:
SQLException
-
clearHasTriedMaster
@Deprecated public void clearHasTriedMaster()
已过时。- 指定者:
clearHasTriedMaster在接口中JdbcConnection- 覆盖:
clearHasTriedMaster在类中MultiHostMySQLConnection
-
-