public interface JdbcConnection extends java.sql.Connection, MysqlConnection, TransactionEventHandler
Modifier and Type | Method and Description |
---|---|
void |
abortInternal()
Clobbers the physical network connection and marks this connection as closed.
|
void |
changeUser(java.lang.String userName,
java.lang.String newPassword)
Changes the user on this connection by performing a re-authentication.
|
void |
clearHasTriedMaster()
Deprecated.
|
java.sql.PreparedStatement |
clientPrepareStatement(java.lang.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.
|
java.sql.PreparedStatement |
clientPrepareStatement(java.lang.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.
|
java.sql.PreparedStatement |
clientPrepareStatement(java.lang.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.
|
java.sql.PreparedStatement |
clientPrepareStatement(java.lang.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.
|
java.sql.PreparedStatement |
clientPrepareStatement(java.lang.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.
|
java.sql.PreparedStatement |
clientPrepareStatement(java.lang.String sql,
java.lang.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(java.lang.String sql)
Returns cached metadata (or null if not cached) for the given query, which must match _exactly_.
|
java.lang.String |
getCharacterSetMetadata() |
ClientInfoProvider |
getClientInfoProviderImpl() |
java.lang.String |
getDatabase()
Retrieves this connection object's current database name.
|
java.lang.String |
getHost() |
java.lang.String |
getHostPortPair() |
long |
getIdleFor()
Reports how long this connection has been idle.
|
java.sql.Statement |
getMetadataSafeStatement() |
JdbcConnection |
getMultiHostParentProxy() |
JdbcConnection |
getMultiHostSafeProxy() |
JdbcPropertySet |
getPropertySet() |
java.util.List<QueryInterceptor> |
getQueryInterceptorsInstances() |
ServerVersion |
getServerVersion() |
int |
getSessionMaxRows()
Returns the sql select limit max-rows for this session.
|
java.lang.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(java.lang.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?
|
boolean |
isMasterConnection()
Is this connection connected to the first host in the list if
there is a list of servers in the URL?
|
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 |
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,
java.lang.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.
|
java.sql.PreparedStatement |
serverPrepareStatement(java.lang.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.
|
java.sql.PreparedStatement |
serverPrepareStatement(java.lang.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.
|
java.sql.PreparedStatement |
serverPrepareStatement(java.lang.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.
|
java.sql.PreparedStatement |
serverPrepareStatement(java.lang.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.
|
java.sql.PreparedStatement |
serverPrepareStatement(java.lang.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.
|
java.sql.PreparedStatement |
serverPrepareStatement(java.lang.String sql,
java.lang.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(java.lang.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(java.lang.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, setTypeMap
checkClosed, cleanup, createNewIO, getConnectionMutex, getExceptionInterceptor, getId, getProperties, getSession, getURL, getUser, normalClose
transactionBegun, transactionCompleted
JdbcPropertySet getPropertySet()
getPropertySet
in interface MysqlConnection
void changeUser(java.lang.String userName, java.lang.String newPassword) throws java.sql.SQLException
userName
- the username to authenticate withnewPassword
- the password to authenticate withjava.sql.SQLException
- if authentication fails, or some other error occurs while
performing the command.@Deprecated void clearHasTriedMaster()
java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql) throws java.sql.SQLException
sql
- statementjava.sql.SQLException
- if an error occursConnection.prepareStatement(String)
java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql, int autoGenKeyIndex) throws java.sql.SQLException
sql
- statementautoGenKeyIndex
- autoGenKeyIndexjava.sql.SQLException
- if an error occursConnection.prepareStatement(String, int)
java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
sql
- statementresultSetType
- resultSetTyperesultSetConcurrency
- resultSetConcurrencyjava.sql.SQLException
- if an error occursConnection.prepareStatement(String, int, int)
java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql, int[] autoGenKeyIndexes) throws java.sql.SQLException
sql
- statementautoGenKeyIndexes
- autoGenKeyIndexesjava.sql.SQLException
- if an error occursConnection.prepareStatement(String, int[])
java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException
sql
- statementresultSetType
- resultSetTyperesultSetConcurrency
- resultSetConcurrencyresultSetHoldability
- resultSetHoldabilityjava.sql.SQLException
- if an error occursConnection.prepareStatement(String, int, int, int)
java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql, java.lang.String[] autoGenKeyColNames) throws java.sql.SQLException
sql
- statementautoGenKeyColNames
- autoGenKeyColNamesjava.sql.SQLException
- if an error occursConnection.prepareStatement(String, String[])
int getActiveStatementCount()
long getIdleFor()
java.lang.String getStatementComment()
@Deprecated boolean hasTriedMaster()
boolean isInGlobalTx()
void setInGlobalTx(boolean flag)
flag
- the state flagboolean isMasterConnection()
boolean isSameResource(JdbcConnection c)
c
- connectionboolean lowerCaseTableNames()
void ping() throws java.sql.SQLException
java.sql.SQLException
- if the ping failsvoid resetServerState() throws java.sql.SQLException
java.sql.SQLException
- if the operation fails while resetting server state.java.sql.PreparedStatement serverPrepareStatement(java.lang.String sql) throws java.sql.SQLException
sql
- statementjava.sql.SQLException
- if an error occursConnection.prepareStatement(String)
java.sql.PreparedStatement serverPrepareStatement(java.lang.String sql, int autoGenKeyIndex) throws java.sql.SQLException
sql
- statementautoGenKeyIndex
- autoGenKeyIndexjava.sql.SQLException
- if an error occursConnection.prepareStatement(String, int)
java.sql.PreparedStatement serverPrepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
sql
- statementresultSetType
- resultSetTyperesultSetConcurrency
- resultSetConcurrencyjava.sql.SQLException
- if an error occursConnection.prepareStatement(String, int, int)
java.sql.PreparedStatement serverPrepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException
sql
- statementresultSetType
- resultSetTyperesultSetConcurrency
- resultSetConcurrencyresultSetHoldability
- resultSetHoldabilityjava.sql.SQLException
- if an error occursConnection.prepareStatement(String, int, int, int)
java.sql.PreparedStatement serverPrepareStatement(java.lang.String sql, int[] autoGenKeyIndexes) throws java.sql.SQLException
sql
- statementautoGenKeyIndexes
- autoGenKeyIndexesjava.sql.SQLException
- if an error occursConnection.prepareStatement(String, int[])
java.sql.PreparedStatement serverPrepareStatement(java.lang.String sql, java.lang.String[] autoGenKeyColNames) throws java.sql.SQLException
sql
- statementautoGenKeyColNames
- autoGenKeyColNamesjava.sql.SQLException
- if an error occursConnection.prepareStatement(String, String[])
void setFailedOver(boolean flag)
flag
- The failedOver flag to set.void setStatementComment(java.lang.String comment)
comment
- the comment that will be prepended to all statements
sent to the server.void shutdownServer() throws java.sql.SQLException
java.sql.SQLException
- if the command can not be issued.int getAutoIncrementIncrement()
boolean hasSameProperties(JdbcConnection c)
c
- connectionjava.lang.String getHost()
java.lang.String getHostPortPair()
void setProxy(JdbcConnection proxy)
boolean isServerLocal() throws java.sql.SQLException
java.sql.SQLException
- if an error occursint getSessionMaxRows()
void setSessionMaxRows(int max) throws java.sql.SQLException
max
- the new max-rows value to set.java.sql.SQLException
- if a database error occurs issuing the statement that sets the limit.void abortInternal() throws java.sql.SQLException
java.sql.SQLException
- if an error occursboolean isProxySet()
CachedResultSetMetaData getCachedMetaData(java.lang.String sql)
sql
- the query that is the key to the cachejava.lang.String getCharacterSetMetadata()
java.sql.Statement getMetadataSafeStatement() throws java.sql.SQLException
java.sql.SQLException
ServerVersion getServerVersion()
java.util.List<QueryInterceptor> getQueryInterceptorsInstances()
void initializeResultsMetadataFromCache(java.lang.String sql, CachedResultSetMetaData cachedMetaData, ResultSetInternalMethods resultSet) throws java.sql.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.java.sql.SQLException
- if an error occursvoid initializeSafeQueryInterceptors() throws java.sql.SQLException
java.sql.SQLException
boolean isReadOnly(boolean useSessionStatus) throws java.sql.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 casejava.sql.SQLException
- if a database access error occursvoid pingInternal(boolean checkForClosedConnection, int timeoutMillis) throws java.sql.SQLException
java.sql.SQLException
void realClose(boolean calledExplicitly, boolean issueRollback, boolean skipLocalTeardown, java.lang.Throwable reason) throws java.sql.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 calljava.sql.SQLException
- if an error occursvoid recachePreparedStatement(JdbcPreparedStatement pstmt) throws java.sql.SQLException
java.sql.SQLException
void decachePreparedStatement(JdbcPreparedStatement pstmt) throws java.sql.SQLException
java.sql.SQLException
void registerStatement(JdbcStatement stmt)
stmt
- the Statement instance to removevoid setReadOnlyInternal(boolean readOnlyFlag) throws java.sql.SQLException
java.sql.SQLException
boolean storesLowerCaseTableName()
void throwConnectionClosedException() throws java.sql.SQLException
java.sql.SQLException
void unregisterStatement(JdbcStatement stmt)
stmt
- the Statement instance to removevoid unSafeQueryInterceptors() throws java.sql.SQLException
java.sql.SQLException
JdbcConnection getMultiHostSafeProxy()
JdbcConnection getMultiHostParentProxy()
JdbcConnection getActiveMySQLConnection()
ClientInfoProvider getClientInfoProviderImpl() throws java.sql.SQLException
java.sql.SQLException
void setDatabase(java.lang.String dbName) throws java.sql.SQLException
dbName
- the database for this connection to usejava.sql.SQLException
- if a database access error occursjava.lang.String getDatabase() throws java.sql.SQLException
java.sql.SQLException
- if an error occurs