public interface JdbcConnection extends Connection, MysqlConnection, TransactionEventHandler
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE| Modifier and Type | Method and Description |
|---|---|
void |
abortInternal()
Clobbers the physical network connection and marks this connection as closed.
|
void |
changeUser(String userName,
String newPassword)
Changes the user on this connection by performing a re-authentication.
|
void |
clearHasTriedMaster()
Deprecated.
|
PreparedStatement |
clientPrepareStatement(String sql)
Prepares a statement on the client, using client-side emulation
(irregardless of the configuration property 'useServerPrepStmts')
with the same semantics as the java.sql.Connection.prepareStatement()
method with the same argument types.
|
PreparedStatement |
clientPrepareStatement(String sql,
int autoGenKeyIndex)
Prepares a statement on the client, using client-side emulation
(irregardless of the configuration property 'useServerPrepStmts')
with the same semantics as the java.sql.Connection.prepareStatement()
method with the same argument types.
|
PreparedStatement |
clientPrepareStatement(String sql,
int[] autoGenKeyIndexes)
Prepares a statement on the client, using client-side emulation
(irregardless of the configuration property 'useServerPrepStmts')
with the same semantics as the java.sql.Connection.prepareStatement()
method with the same argument types.
|
PreparedStatement |
clientPrepareStatement(String sql,
int resultSetType,
int resultSetConcurrency)
Prepares a statement on the client, using client-side emulation
(irregardless of the configuration property 'useServerPrepStmts')
with the same semantics as the java.sql.Connection.prepareStatement()
method with the same argument types.
|
PreparedStatement |
clientPrepareStatement(String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
Prepares a statement on the client, using client-side emulation
(irregardless of the configuration property 'useServerPrepStmts')
with the same semantics as the java.sql.Connection.prepareStatement()
method with the same argument types.
|
PreparedStatement |
clientPrepareStatement(String sql,
String[] autoGenKeyColNames)
Prepares a statement on the client, using client-side emulation
(irregardless of the configuration property 'useServerPrepStmts')
with the same semantics as the java.sql.Connection.prepareStatement()
method with the same argument types.
|
void |
decachePreparedStatement(JdbcPreparedStatement pstmt) |
JdbcConnection |
getActiveMySQLConnection() |
int |
getActiveStatementCount()
Returns the number of statements active on this connection, which
haven't been .close()d.
|
int |
getAutoIncrementIncrement()
Returns the -session- value of 'auto_increment_increment' from the server if it exists,
or '1' if not.
|
CachedResultSetMetaData |
getCachedMetaData(String sql)
Returns cached metadata (or null if not cached) for the given query, which must match _exactly_.
|
String |
getCharacterSetMetadata() |
ClientInfoProvider |
getClientInfoProviderImpl() |
String |
getDatabase()
Retrieves this connection object's current database name.
|
String |
getHost() |
String |
getHostPortPair() |
long |
getIdleFor()
Reports how long this connection has been idle.
|
Statement |
getMetadataSafeStatement() |
JdbcConnection |
getMultiHostParentProxy() |
JdbcConnection |
getMultiHostSafeProxy() |
JdbcPropertySet |
getPropertySet() |
List<QueryInterceptor> |
getQueryInterceptorsInstances() |
ServerVersion |
getServerVersion() |
int |
getSessionMaxRows()
Returns the sql select limit max-rows for this session.
|
String |
getStatementComment()
Returns the comment that will be prepended to all statements
sent to the server.
|
boolean |
hasSameProperties(JdbcConnection c)
Does this connection have the same properties as another?
|
boolean |
hasTriedMaster()
Deprecated.
|
void |
initializeResultsMetadataFromCache(String sql,
CachedResultSetMetaData cachedMetaData,
ResultSetInternalMethods resultSet)
Caches CachedResultSetMetaData that has been placed in the cache using the given SQL as a key.
|
void |
initializeSafeQueryInterceptors() |
boolean |
isInGlobalTx()
Is this connection currently a participant in an XA transaction?
|
default boolean |
isMasterConnection()
Deprecated.
|
boolean |
isProxySet() |
boolean |
isReadOnly(boolean useSessionStatus)
Tests to see if the connection is in Read Only Mode.
|
boolean |
isSameResource(JdbcConnection c)
Does this connection have the same resource name as the given
connection (for XA)?
|
boolean |
isServerLocal()
Is the server this connection is connected to "local" (i.e.
|
boolean |
isSourceConnection()
Is this connection connected to the first host in the list if
there is a list of servers in the URL?
|
boolean |
lowerCaseTableNames()
Is the server configured to use lower-case table names only?
|
void |
ping()
Detect if the connection is still good by sending a ping command
to the server.
|
void |
pingInternal(boolean checkForClosedConnection,
int timeoutMillis) |
void |
realClose(boolean calledExplicitly,
boolean issueRollback,
boolean skipLocalTeardown,
Throwable reason)
Closes connection and frees resources.
|
void |
recachePreparedStatement(JdbcPreparedStatement pstmt) |
void |
registerStatement(JdbcStatement stmt)
Register a Statement instance as open.
|
void |
resetServerState()
Resets the server-side state of this connection.
|
PreparedStatement |
serverPrepareStatement(String sql)
Prepares a statement on the server (irregardless of the
configuration property 'useServerPrepStmts') with the same semantics
as the java.sql.Connection.prepareStatement() method with the
same argument types.
|
PreparedStatement |
serverPrepareStatement(String sql,
int autoGenKeyIndex)
Prepares a statement on the server (irregardless of the
configuration property 'useServerPrepStmts') with the same semantics
as the java.sql.Connection.prepareStatement() method with the
same argument types.
|
PreparedStatement |
serverPrepareStatement(String sql,
int[] autoGenKeyIndexes)
Prepares a statement on the server (irregardless of the
configuration property 'useServerPrepStmts') with the same semantics
as the java.sql.Connection.prepareStatement() method with the
same argument types.
|
PreparedStatement |
serverPrepareStatement(String sql,
int resultSetType,
int resultSetConcurrency)
Prepares a statement on the server (irregardless of the
configuration property 'useServerPrepStmts') with the same semantics
as the java.sql.Connection.prepareStatement() method with the
same argument types.
|
PreparedStatement |
serverPrepareStatement(String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
Prepares a statement on the server (irregardless of the
configuration property 'useServerPrepStmts') with the same semantics
as the java.sql.Connection.prepareStatement() method with the
same argument types.
|
PreparedStatement |
serverPrepareStatement(String sql,
String[] autoGenKeyColNames)
Prepares a statement on the server (irregardless of the
configuration property 'useServerPrepStmts') with the same semantics
as the java.sql.Connection.prepareStatement() method with the
same argument types.
|
void |
setDatabase(String dbName)
Set current database for this connection.
|
void |
setFailedOver(boolean flag) |
void |
setInGlobalTx(boolean flag)
Set the state of being in a global (XA) transaction.
|
void |
setProxy(JdbcConnection proxy) |
void |
setReadOnlyInternal(boolean readOnlyFlag) |
void |
setSessionMaxRows(int max)
Sets the sql select limit max-rows for this session if different from current.
|
void |
setStatementComment(String comment)
Sets the comment that will be prepended to all statements
sent to the server.
|
void |
shutdownServer()
Used by MiniAdmin to shutdown a MySQL server
|
boolean |
storesLowerCaseTableName() |
void |
throwConnectionClosedException() |
void |
unregisterStatement(JdbcStatement stmt)
Remove the given statement from the list of open statements
|
void |
unSafeQueryInterceptors() |
abort, clearWarnings, close, commit, createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStatement, createStatement, createStatement, createStruct, getAutoCommit, getCatalog, getClientInfo, getClientInfo, getHoldability, getMetaData, getNetworkTimeout, getSchema, getTransactionIsolation, getTypeMap, getWarnings, isClosed, isReadOnly, isValid, nativeSQL, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, rollback, setAutoCommit, setCatalog, setClientInfo, setClientInfo, setHoldability, setNetworkTimeout, setReadOnly, setSavepoint, setSavepoint, setSchema, setTransactionIsolation, setTypeMapisWrapperFor, unwrapcheckClosed, cleanup, createNewIO, getConnectionMutex, getExceptionInterceptor, getId, getProperties, getServerSessionStateController, getSession, getURL, getUser, normalClosetransactionBegun, transactionCompletedJdbcPropertySet getPropertySet()
getPropertySet in interface MysqlConnectionvoid changeUser(String userName, String newPassword) throws SQLException
userName - the username to authenticate withnewPassword - the password to authenticate withSQLException - if authentication fails, or some other error occurs while
performing the command.@Deprecated void clearHasTriedMaster()
PreparedStatement clientPrepareStatement(String sql) throws SQLException
sql - statementSQLException - if an error occursConnection.prepareStatement(String)PreparedStatement clientPrepareStatement(String sql, int autoGenKeyIndex) throws SQLException
sql - statementautoGenKeyIndex - autoGenKeyIndexSQLException - if an error occursConnection.prepareStatement(String, int)PreparedStatement clientPrepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
sql - statementresultSetType - resultSetTyperesultSetConcurrency - resultSetConcurrencySQLException - if an error occursConnection.prepareStatement(String, int, int)PreparedStatement clientPrepareStatement(String sql, int[] autoGenKeyIndexes) throws SQLException
sql - statementautoGenKeyIndexes - autoGenKeyIndexesSQLException - if an error occursConnection.prepareStatement(String, int[])PreparedStatement clientPrepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
sql - statementresultSetType - resultSetTyperesultSetConcurrency - resultSetConcurrencyresultSetHoldability - resultSetHoldabilitySQLException - if an error occursConnection.prepareStatement(String, int, int, int)PreparedStatement clientPrepareStatement(String sql, String[] autoGenKeyColNames) throws SQLException
sql - statementautoGenKeyColNames - autoGenKeyColNamesSQLException - if an error occursConnection.prepareStatement(String, String[])int getActiveStatementCount()
long getIdleFor()
String getStatementComment()
@Deprecated boolean hasTriedMaster()
boolean isInGlobalTx()
void setInGlobalTx(boolean flag)
flag - the state flagboolean isSourceConnection()
@Deprecated default boolean isMasterConnection()
isSourceConnection() instead.boolean isSameResource(JdbcConnection c)
c - connectionboolean lowerCaseTableNames()
void ping() throws SQLException
SQLException - if the ping failsvoid resetServerState()
throws SQLException
SQLException - if the operation fails while resetting server state.PreparedStatement serverPrepareStatement(String sql) throws SQLException
sql - statementSQLException - if an error occursConnection.prepareStatement(String)PreparedStatement serverPrepareStatement(String sql, int autoGenKeyIndex) throws SQLException
sql - statementautoGenKeyIndex - autoGenKeyIndexSQLException - if an error occursConnection.prepareStatement(String, int)PreparedStatement serverPrepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
sql - statementresultSetType - resultSetTyperesultSetConcurrency - resultSetConcurrencySQLException - if an error occursConnection.prepareStatement(String, int, int)PreparedStatement serverPrepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
sql - statementresultSetType - resultSetTyperesultSetConcurrency - resultSetConcurrencyresultSetHoldability - resultSetHoldabilitySQLException - if an error occursConnection.prepareStatement(String, int, int, int)PreparedStatement serverPrepareStatement(String sql, int[] autoGenKeyIndexes) throws SQLException
sql - statementautoGenKeyIndexes - autoGenKeyIndexesSQLException - if an error occursConnection.prepareStatement(String, int[])PreparedStatement serverPrepareStatement(String sql, String[] autoGenKeyColNames) throws SQLException
sql - statementautoGenKeyColNames - autoGenKeyColNamesSQLException - if an error occursConnection.prepareStatement(String, String[])void setFailedOver(boolean flag)
flag - The failedOver flag to set.void setStatementComment(String comment)
comment - the comment that will be prepended to all statements
sent to the server.void shutdownServer()
throws SQLException
SQLException - if the command can not be issued.int getAutoIncrementIncrement()
boolean hasSameProperties(JdbcConnection c)
c - connectionString getHost()
String getHostPortPair()
void setProxy(JdbcConnection proxy)
boolean isServerLocal()
throws SQLException
SQLException - if an error occursint getSessionMaxRows()
void setSessionMaxRows(int max)
throws SQLException
max - the new max-rows value to set.SQLException - if a database error occurs issuing the statement that sets the limit.void abortInternal()
throws SQLException
SQLException - if an error occursboolean isProxySet()
CachedResultSetMetaData getCachedMetaData(String sql)
sql - the query that is the key to the cacheString getCharacterSetMetadata()
Statement getMetadataSafeStatement() throws SQLException
SQLExceptionServerVersion getServerVersion()
List<QueryInterceptor> getQueryInterceptorsInstances()
void initializeResultsMetadataFromCache(String sql, CachedResultSetMetaData cachedMetaData, ResultSetInternalMethods resultSet) throws SQLException
sql - the query that the metadata pertains too.cachedMetaData - metadata (if it exists) to populate the cache.resultSet - the result set to retreive metadata from, or apply to.SQLException - if an error occursvoid initializeSafeQueryInterceptors()
throws SQLException
SQLExceptionboolean isReadOnly(boolean useSessionStatus)
throws SQLException
useSessionStatus - in some cases, for example when restoring connection with autoReconnect=true,
we can rely only on saved readOnly state, so use useSessionStatus=false in that caseSQLException - if a database access error occursvoid pingInternal(boolean checkForClosedConnection,
int timeoutMillis)
throws SQLException
SQLExceptionvoid realClose(boolean calledExplicitly,
boolean issueRollback,
boolean skipLocalTeardown,
Throwable reason)
throws SQLException
calledExplicitly - is this being called from close()issueRollback - should a rollback() be issued?skipLocalTeardown - if true, driver tries to close connection normally, performing rollbacks,
closing open statements etc; otherwise the force close is performedreason - the exception caused this method callSQLException - if an error occursvoid recachePreparedStatement(JdbcPreparedStatement pstmt) throws SQLException
SQLExceptionvoid decachePreparedStatement(JdbcPreparedStatement pstmt) throws SQLException
SQLExceptionvoid registerStatement(JdbcStatement stmt)
stmt - the Statement instance to removevoid setReadOnlyInternal(boolean readOnlyFlag)
throws SQLException
SQLExceptionboolean storesLowerCaseTableName()
void throwConnectionClosedException()
throws SQLException
SQLExceptionvoid unregisterStatement(JdbcStatement stmt)
stmt - the Statement instance to removevoid unSafeQueryInterceptors()
throws SQLException
SQLExceptionJdbcConnection getMultiHostSafeProxy()
JdbcConnection getMultiHostParentProxy()
JdbcConnection getActiveMySQLConnection()
ClientInfoProvider getClientInfoProviderImpl() throws SQLException
SQLExceptionvoid setDatabase(String dbName) throws SQLException
dbName - the database for this connection to useSQLException - if a database access error occursString getDatabase() throws SQLException
SQLException - if an error occurs