public class ConnectionImpl extends java.lang.Object implements JdbcConnection, Session.SessionEventListener, java.io.Serializable
A Connection's database is able to provide information describing its tables, its supported SQL grammar, its stored procedures, the capabilities of this connection, etc. This information is obtained with the getMetaData method.
Modifier and Type | Field and Description |
---|---|
static java.util.Map<?,?> |
charsetMap
The mapping between MySQL charset names and Java charset names.
|
protected static java.lang.String |
DEFAULT_LOGGER_CLASS
Default logger class name
|
protected ResultSetFactory |
nullStatementResultSetFactory |
protected JdbcPropertySet |
propertySet |
protected java.util.Properties |
props
Properties for this connection specified by user
|
protected LRUCache<java.lang.String,CachedResultSetMetaData> |
resultSetMetadataCache
Cache of ResultSet metadata
|
protected static java.util.Map<?,?> |
roundRobinStatsMap |
Modifier | Constructor and Description |
---|---|
protected |
ConnectionImpl()
'
For the delegate only
|
|
ConnectionImpl(HostInfo hostInfo)
Creates a connection to a MySQL Server.
|
Modifier and Type | Method and Description |
---|---|
void |
abort(java.util.concurrent.Executor executor) |
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 |
checkClosed() |
void |
cleanup(java.lang.Throwable whyCleanedUp)
Destroys this connection and any underlying resources.
|
void |
clearHasTriedMaster()
Deprecated.
|
void |
clearWarnings() |
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,
boolean processEscapeCodesIfNeeded) |
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 |
close() |
void |
commit() |
java.sql.Array |
createArrayOf(java.lang.String typeName,
java.lang.Object[] elements) |
java.sql.Blob |
createBlob() |
java.sql.Clob |
createClob() |
java.sql.NClob |
createNClob() |
void |
createNewIO(boolean isForReconnect)
Creates an IO channel to the server.
|
java.sql.SQLXML |
createSQLXML() |
java.sql.Statement |
createStatement() |
java.sql.Statement |
createStatement(int resultSetType,
int resultSetConcurrency) |
java.sql.Statement |
createStatement(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability) |
java.sql.Struct |
createStruct(java.lang.String typeName,
java.lang.Object[] attributes) |
void |
decachePreparedStatement(JdbcPreparedStatement pstmt) |
JdbcConnection |
getActiveMySQLConnection() |
int |
getActiveStatementCount()
Returns the number of statements active on this connection, which
haven't been .close()d.
|
boolean |
getAutoCommit() |
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 |
getCatalog() |
java.lang.String |
getCharacterSetMetadata() |
java.util.Properties |
getClientInfo() |
java.lang.String |
getClientInfo(java.lang.String name) |
ClientInfoProvider |
getClientInfoProviderImpl() |
java.lang.Object |
getConnectionMutex() |
java.lang.String |
getDatabase()
Retrieves this connection object's current database name.
|
ExceptionInterceptor |
getExceptionInterceptor() |
int |
getHoldability() |
java.lang.String |
getHost() |
java.lang.String |
getHostPortPair() |
long |
getId() |
long |
getIdleFor()
NOT JDBC-Compliant, but clients can use this method to determine how long
this connection has been idle.
|
static JdbcConnection |
getInstance(HostInfo hostInfo)
Creates a connection instance.
|
java.sql.DatabaseMetaData |
getMetaData() |
java.sql.Statement |
getMetadataSafeStatement() |
java.sql.Statement |
getMetadataSafeStatement(int maxRows) |
JdbcConnection |
getMultiHostParentProxy() |
JdbcConnection |
getMultiHostSafeProxy() |
int |
getNetworkTimeout() |
protected static int |
getNextRoundRobinHostIndex(java.lang.String url,
java.util.List<?> hostList) |
java.util.Properties |
getProperties()
Returns the parsed and passed in properties for this connection.
|
JdbcPropertySet |
getPropertySet() |
java.util.List<QueryInterceptor> |
getQueryInterceptorsInstances() |
java.lang.String |
getSchema() |
ServerVersion |
getServerVersion() |
NativeSession |
getSession() |
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.
|
int |
getTransactionIsolation() |
java.util.Map<java.lang.String,java.lang.Class<?>> |
getTypeMap() |
java.lang.String |
getURL() |
java.lang.String |
getUser() |
java.sql.SQLWarning |
getWarnings() |
void |
handleCleanup(java.lang.Throwable whyCleanedUp) |
void |
handleNormalClose() |
void |
handleReconnect() |
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 |
isClosed() |
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 |
isReadOnly(boolean useSessionStatus)
Tests to see if the connection is in Read Only Mode.
|
boolean |
isSameResource(JdbcConnection otherConnection)
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 |
isValid(int timeout) |
boolean |
isWrapperFor(java.lang.Class<?> iface) |
boolean |
lowerCaseTableNames()
Is the server configured to use lower-case table names only?
|
java.lang.String |
nativeSQL(java.lang.String sql) |
void |
normalClose() |
void |
ping()
Detect if the connection is still good by sending a ping command
to the server.
|
void |
pingInternal(boolean checkForClosedConnection,
int timeoutMillis) |
java.sql.CallableStatement |
prepareCall(java.lang.String sql) |
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency) |
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability) |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql) |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int autoGenKeyIndex) |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int[] autoGenKeyIndexes) |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency) |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability) |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
java.lang.String[] autoGenKeyColNames) |
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 |
releaseSavepoint(java.sql.Savepoint arg0) |
void |
resetServerState()
Resets the server-side state of this connection.
|
void |
rollback() |
void |
rollback(java.sql.Savepoint savepoint) |
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 |
setAutoCommit(boolean autoCommitFlag) |
void |
setCatalog(java.lang.String catalog) |
void |
setClientInfo(java.util.Properties properties) |
void |
setClientInfo(java.lang.String name,
java.lang.String value) |
void |
setDatabase(java.lang.String db)
Set current database for this connection.
|
void |
setFailedOver(boolean flag) |
void |
setHoldability(int arg0) |
void |
setInGlobalTx(boolean flag)
Set the state of being in a global (XA) transaction.
|
void |
setNetworkTimeout(java.util.concurrent.Executor executor,
int milliseconds) |
void |
setProxy(JdbcConnection proxy) |
void |
setReadOnly(boolean readOnlyFlag) |
void |
setReadOnlyInternal(boolean readOnlyFlag) |
java.sql.Savepoint |
setSavepoint() |
java.sql.Savepoint |
setSavepoint(java.lang.String name) |
void |
setSchema(java.lang.String schema) |
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 |
setTransactionIsolation(int level) |
void |
setTypeMap(java.util.Map<java.lang.String,java.lang.Class<?>> map) |
void |
shutdownServer()
Used by MiniAdmin to shutdown a MySQL server
|
boolean |
storesLowerCaseTableName() |
void |
throwConnectionClosedException() |
void |
transactionBegun() |
void |
transactionCompleted() |
void |
unregisterStatement(JdbcStatement stmt)
Remove the given statement from the list of open statements
|
void |
unSafeQueryInterceptors() |
<T> T |
unwrap(java.lang.Class<T> iface) |
boolean |
versionMeetsMinimum(int major,
int minor,
int subminor) |
public static java.util.Map<?,?> charsetMap
protected static final java.lang.String DEFAULT_LOGGER_CLASS
protected static java.util.Map<?,?> roundRobinStatsMap
protected java.util.Properties props
protected LRUCache<java.lang.String,CachedResultSetMetaData> resultSetMetadataCache
protected JdbcPropertySet propertySet
protected ResultSetFactory nullStatementResultSetFactory
protected ConnectionImpl()
public ConnectionImpl(HostInfo hostInfo) throws java.sql.SQLException
hostInfo
- the HostInfo
instance that contains the host, user and connections attributes for this connectionjava.sql.SQLException
- if a database access error occurspublic java.lang.String getHost()
getHost
in interface JdbcConnection
public boolean isProxySet()
isProxySet
in interface JdbcConnection
public void setProxy(JdbcConnection proxy)
setProxy
in interface JdbcConnection
public JdbcConnection getMultiHostSafeProxy()
getMultiHostSafeProxy
in interface JdbcConnection
public JdbcConnection getMultiHostParentProxy()
getMultiHostParentProxy
in interface JdbcConnection
public JdbcConnection getActiveMySQLConnection()
getActiveMySQLConnection
in interface JdbcConnection
public java.lang.Object getConnectionMutex()
getConnectionMutex
in interface MysqlConnection
public static JdbcConnection getInstance(HostInfo hostInfo) throws java.sql.SQLException
hostInfo
- HostInfo
instanceConnectionImpl
instancejava.sql.SQLException
- if a database access error occursprotected static int getNextRoundRobinHostIndex(java.lang.String url, java.util.List<?> hostList)
url
- connection URLhostList
- hosts listpublic JdbcPropertySet getPropertySet()
getPropertySet
in interface JdbcConnection
getPropertySet
in interface MysqlConnection
public void unSafeQueryInterceptors() throws java.sql.SQLException
unSafeQueryInterceptors
in interface JdbcConnection
java.sql.SQLException
public void initializeSafeQueryInterceptors() throws java.sql.SQLException
initializeSafeQueryInterceptors
in interface JdbcConnection
java.sql.SQLException
public java.util.List<QueryInterceptor> getQueryInterceptorsInstances()
getQueryInterceptorsInstances
in interface JdbcConnection
public void changeUser(java.lang.String userName, java.lang.String newPassword) throws java.sql.SQLException
JdbcConnection
changeUser
in interface JdbcConnection
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.public void checkClosed()
checkClosed
in interface MysqlConnection
public void throwConnectionClosedException() throws java.sql.SQLException
throwConnectionClosedException
in interface JdbcConnection
java.sql.SQLException
public void abortInternal() throws java.sql.SQLException
JdbcConnection
abortInternal
in interface JdbcConnection
java.sql.SQLException
- if an error occurspublic void cleanup(java.lang.Throwable whyCleanedUp)
MysqlConnection
cleanup
in interface MysqlConnection
whyCleanedUp
- exception caused the connection clean up@Deprecated public void clearHasTriedMaster()
clearHasTriedMaster
in interface JdbcConnection
public void clearWarnings() throws java.sql.SQLException
clearWarnings
in interface java.sql.Connection
java.sql.SQLException
public java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql) throws java.sql.SQLException
JdbcConnection
clientPrepareStatement
in interface JdbcConnection
sql
- statementjava.sql.SQLException
- if an error occursConnection.prepareStatement(String)
public java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql, int autoGenKeyIndex) throws java.sql.SQLException
JdbcConnection
clientPrepareStatement
in interface JdbcConnection
sql
- statementautoGenKeyIndex
- autoGenKeyIndexjava.sql.SQLException
- if an error occursConnection.prepareStatement(String, int)
public java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
JdbcConnection
clientPrepareStatement
in interface JdbcConnection
sql
- statementresultSetType
- resultSetTyperesultSetConcurrency
- resultSetConcurrencyjava.sql.SQLException
- if an error occursConnection.prepareStatement(String, int, int)
public java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, boolean processEscapeCodesIfNeeded) throws java.sql.SQLException
java.sql.SQLException
public java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql, int[] autoGenKeyIndexes) throws java.sql.SQLException
JdbcConnection
clientPrepareStatement
in interface JdbcConnection
sql
- statementautoGenKeyIndexes
- autoGenKeyIndexesjava.sql.SQLException
- if an error occursConnection.prepareStatement(String, int[])
public java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql, java.lang.String[] autoGenKeyColNames) throws java.sql.SQLException
JdbcConnection
clientPrepareStatement
in interface JdbcConnection
sql
- statementautoGenKeyColNames
- autoGenKeyColNamesjava.sql.SQLException
- if an error occursConnection.prepareStatement(String, String[])
public java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException
JdbcConnection
clientPrepareStatement
in interface JdbcConnection
sql
- statementresultSetType
- resultSetTyperesultSetConcurrency
- resultSetConcurrencyresultSetHoldability
- resultSetHoldabilityjava.sql.SQLException
- if an error occursConnection.prepareStatement(String, int, int, int)
public void close() throws java.sql.SQLException
close
in interface java.lang.AutoCloseable
close
in interface java.sql.Connection
java.sql.SQLException
public void normalClose()
normalClose
in interface MysqlConnection
public void commit() throws java.sql.SQLException
commit
in interface java.sql.Connection
java.sql.SQLException
public void createNewIO(boolean isForReconnect)
MysqlConnection
createNewIO
in interface MysqlConnection
isForReconnect
- is this request for a re-connectpublic java.sql.Statement createStatement() throws java.sql.SQLException
createStatement
in interface java.sql.Connection
java.sql.SQLException
public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
createStatement
in interface java.sql.Connection
java.sql.SQLException
public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException
createStatement
in interface java.sql.Connection
java.sql.SQLException
public int getActiveStatementCount()
JdbcConnection
getActiveStatementCount
in interface JdbcConnection
public boolean getAutoCommit() throws java.sql.SQLException
getAutoCommit
in interface java.sql.Connection
java.sql.SQLException
public java.lang.String getCatalog() throws java.sql.SQLException
getCatalog
in interface java.sql.Connection
java.sql.SQLException
public java.lang.String getCharacterSetMetadata()
getCharacterSetMetadata
in interface JdbcConnection
public int getHoldability() throws java.sql.SQLException
getHoldability
in interface java.sql.Connection
java.sql.SQLException
public long getId()
getId
in interface MysqlConnection
public long getIdleFor()
getIdleFor
in interface JdbcConnection
public java.sql.DatabaseMetaData getMetaData() throws java.sql.SQLException
getMetaData
in interface java.sql.Connection
java.sql.SQLException
public java.sql.Statement getMetadataSafeStatement() throws java.sql.SQLException
getMetadataSafeStatement
in interface JdbcConnection
java.sql.SQLException
public java.sql.Statement getMetadataSafeStatement(int maxRows) throws java.sql.SQLException
java.sql.SQLException
public ServerVersion getServerVersion()
getServerVersion
in interface JdbcConnection
public int getTransactionIsolation() throws java.sql.SQLException
getTransactionIsolation
in interface java.sql.Connection
java.sql.SQLException
public java.util.Map<java.lang.String,java.lang.Class<?>> getTypeMap() throws java.sql.SQLException
getTypeMap
in interface java.sql.Connection
java.sql.SQLException
public java.lang.String getURL()
getURL
in interface MysqlConnection
public java.lang.String getUser()
getUser
in interface MysqlConnection
public java.sql.SQLWarning getWarnings() throws java.sql.SQLException
getWarnings
in interface java.sql.Connection
java.sql.SQLException
public boolean hasSameProperties(JdbcConnection c)
JdbcConnection
hasSameProperties
in interface JdbcConnection
c
- connectionpublic java.util.Properties getProperties()
MysqlConnection
getProperties
in interface MysqlConnection
Properties
@Deprecated public boolean hasTriedMaster()
JdbcConnection
hasTriedMaster
in interface JdbcConnection
public boolean isClosed()
isClosed
in interface java.sql.Connection
public boolean isInGlobalTx()
JdbcConnection
isInGlobalTx
in interface JdbcConnection
public boolean isMasterConnection()
JdbcConnection
isMasterConnection
in interface JdbcConnection
public boolean isReadOnly() throws java.sql.SQLException
isReadOnly
in interface java.sql.Connection
java.sql.SQLException
public boolean isReadOnly(boolean useSessionStatus) throws java.sql.SQLException
JdbcConnection
isReadOnly
in interface JdbcConnection
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 occurspublic boolean isSameResource(JdbcConnection otherConnection)
JdbcConnection
isSameResource
in interface JdbcConnection
otherConnection
- connectionpublic int getAutoIncrementIncrement()
JdbcConnection
getAutoIncrementIncrement
in interface JdbcConnection
public boolean lowerCaseTableNames()
JdbcConnection
lowerCaseTableNames
in interface JdbcConnection
public java.lang.String nativeSQL(java.lang.String sql) throws java.sql.SQLException
nativeSQL
in interface java.sql.Connection
java.sql.SQLException
public void ping() throws java.sql.SQLException
JdbcConnection
ping
in interface JdbcConnection
java.sql.SQLException
- if the ping failspublic void pingInternal(boolean checkForClosedConnection, int timeoutMillis) throws java.sql.SQLException
pingInternal
in interface JdbcConnection
java.sql.SQLException
public java.sql.CallableStatement prepareCall(java.lang.String sql) throws java.sql.SQLException
prepareCall
in interface java.sql.Connection
java.sql.SQLException
public java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
prepareCall
in interface java.sql.Connection
java.sql.SQLException
public java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException
prepareCall
in interface java.sql.Connection
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int autoGenKeyIndex) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int[] autoGenKeyIndexes) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, java.lang.String[] autoGenKeyColNames) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
java.sql.SQLException
public void realClose(boolean calledExplicitly, boolean issueRollback, boolean skipLocalTeardown, java.lang.Throwable reason) throws java.sql.SQLException
JdbcConnection
realClose
in interface JdbcConnection
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 occurspublic void recachePreparedStatement(JdbcPreparedStatement pstmt) throws java.sql.SQLException
recachePreparedStatement
in interface JdbcConnection
java.sql.SQLException
public void decachePreparedStatement(JdbcPreparedStatement pstmt) throws java.sql.SQLException
decachePreparedStatement
in interface JdbcConnection
java.sql.SQLException
public void registerStatement(JdbcStatement stmt)
JdbcConnection
registerStatement
in interface JdbcConnection
stmt
- the Statement instance to removepublic void releaseSavepoint(java.sql.Savepoint arg0) throws java.sql.SQLException
releaseSavepoint
in interface java.sql.Connection
java.sql.SQLException
public void resetServerState() throws java.sql.SQLException
JdbcConnection
resetServerState
in interface JdbcConnection
java.sql.SQLException
- if the operation fails while resetting server state.public void rollback() throws java.sql.SQLException
rollback
in interface java.sql.Connection
java.sql.SQLException
public void rollback(java.sql.Savepoint savepoint) throws java.sql.SQLException
rollback
in interface java.sql.Connection
java.sql.SQLException
public java.sql.PreparedStatement serverPrepareStatement(java.lang.String sql) throws java.sql.SQLException
JdbcConnection
serverPrepareStatement
in interface JdbcConnection
sql
- statementjava.sql.SQLException
- if an error occursConnection.prepareStatement(String)
public java.sql.PreparedStatement serverPrepareStatement(java.lang.String sql, int autoGenKeyIndex) throws java.sql.SQLException
JdbcConnection
serverPrepareStatement
in interface JdbcConnection
sql
- statementautoGenKeyIndex
- autoGenKeyIndexjava.sql.SQLException
- if an error occursConnection.prepareStatement(String, int)
public java.sql.PreparedStatement serverPrepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
JdbcConnection
serverPrepareStatement
in interface JdbcConnection
sql
- statementresultSetType
- resultSetTyperesultSetConcurrency
- resultSetConcurrencyjava.sql.SQLException
- if an error occursConnection.prepareStatement(String, int, int)
public java.sql.PreparedStatement serverPrepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException
JdbcConnection
serverPrepareStatement
in interface JdbcConnection
sql
- statementresultSetType
- resultSetTyperesultSetConcurrency
- resultSetConcurrencyresultSetHoldability
- resultSetHoldabilityjava.sql.SQLException
- if an error occursConnection.prepareStatement(String, int, int, int)
public java.sql.PreparedStatement serverPrepareStatement(java.lang.String sql, int[] autoGenKeyIndexes) throws java.sql.SQLException
JdbcConnection
serverPrepareStatement
in interface JdbcConnection
sql
- statementautoGenKeyIndexes
- autoGenKeyIndexesjava.sql.SQLException
- if an error occursConnection.prepareStatement(String, int[])
public java.sql.PreparedStatement serverPrepareStatement(java.lang.String sql, java.lang.String[] autoGenKeyColNames) throws java.sql.SQLException
JdbcConnection
serverPrepareStatement
in interface JdbcConnection
sql
- statementautoGenKeyColNames
- autoGenKeyColNamesjava.sql.SQLException
- if an error occursConnection.prepareStatement(String, String[])
public void setAutoCommit(boolean autoCommitFlag) throws java.sql.SQLException
setAutoCommit
in interface java.sql.Connection
java.sql.SQLException
public void setCatalog(java.lang.String catalog) throws java.sql.SQLException
setCatalog
in interface java.sql.Connection
java.sql.SQLException
public void setDatabase(java.lang.String db) throws java.sql.SQLException
JdbcConnection
setDatabase
in interface JdbcConnection
db
- the database for this connection to usejava.sql.SQLException
- if a database access error occurspublic java.lang.String getDatabase() throws java.sql.SQLException
JdbcConnection
getDatabase
in interface JdbcConnection
java.sql.SQLException
- if an error occurspublic void setFailedOver(boolean flag)
setFailedOver
in interface JdbcConnection
flag
- The failedOver flag to set.public void setHoldability(int arg0) throws java.sql.SQLException
setHoldability
in interface java.sql.Connection
java.sql.SQLException
public void setInGlobalTx(boolean flag)
JdbcConnection
setInGlobalTx
in interface JdbcConnection
flag
- the state flagpublic void setReadOnly(boolean readOnlyFlag) throws java.sql.SQLException
setReadOnly
in interface java.sql.Connection
java.sql.SQLException
public void setReadOnlyInternal(boolean readOnlyFlag) throws java.sql.SQLException
setReadOnlyInternal
in interface JdbcConnection
java.sql.SQLException
public java.sql.Savepoint setSavepoint() throws java.sql.SQLException
setSavepoint
in interface java.sql.Connection
java.sql.SQLException
public java.sql.Savepoint setSavepoint(java.lang.String name) throws java.sql.SQLException
setSavepoint
in interface java.sql.Connection
java.sql.SQLException
public void setTransactionIsolation(int level) throws java.sql.SQLException
setTransactionIsolation
in interface java.sql.Connection
java.sql.SQLException
public void setTypeMap(java.util.Map<java.lang.String,java.lang.Class<?>> map) throws java.sql.SQLException
setTypeMap
in interface java.sql.Connection
java.sql.SQLException
public void shutdownServer() throws java.sql.SQLException
JdbcConnection
shutdownServer
in interface JdbcConnection
java.sql.SQLException
- if the command can not be issued.public void unregisterStatement(JdbcStatement stmt)
JdbcConnection
unregisterStatement
in interface JdbcConnection
stmt
- the Statement instance to removepublic boolean versionMeetsMinimum(int major, int minor, int subminor)
public CachedResultSetMetaData getCachedMetaData(java.lang.String sql)
JdbcConnection
getCachedMetaData
in interface JdbcConnection
sql
- the query that is the key to the cachepublic void initializeResultsMetadataFromCache(java.lang.String sql, CachedResultSetMetaData cachedMetaData, ResultSetInternalMethods resultSet) throws java.sql.SQLException
JdbcConnection
initializeResultsMetadataFromCache
in interface JdbcConnection
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 occurspublic java.lang.String getStatementComment()
JdbcConnection
getStatementComment
in interface JdbcConnection
public void setStatementComment(java.lang.String comment)
JdbcConnection
setStatementComment
in interface JdbcConnection
comment
- the comment that will be prepended to all statements
sent to the server.public void transactionBegun()
transactionBegun
in interface TransactionEventHandler
public void transactionCompleted()
transactionCompleted
in interface TransactionEventHandler
public boolean storesLowerCaseTableName()
storesLowerCaseTableName
in interface JdbcConnection
public ExceptionInterceptor getExceptionInterceptor()
getExceptionInterceptor
in interface MysqlConnection
public boolean isServerLocal() throws java.sql.SQLException
JdbcConnection
isServerLocal
in interface JdbcConnection
java.sql.SQLException
- if an error occurspublic int getSessionMaxRows()
JdbcConnection
getSessionMaxRows
in interface JdbcConnection
public void setSessionMaxRows(int max) throws java.sql.SQLException
JdbcConnection
setSessionMaxRows
in interface JdbcConnection
max
- the new max-rows value to set.java.sql.SQLException
- if a database error occurs issuing the statement that sets the limit.public void setSchema(java.lang.String schema) throws java.sql.SQLException
setSchema
in interface java.sql.Connection
java.sql.SQLException
public java.lang.String getSchema() throws java.sql.SQLException
getSchema
in interface java.sql.Connection
java.sql.SQLException
public void abort(java.util.concurrent.Executor executor) throws java.sql.SQLException
abort
in interface java.sql.Connection
java.sql.SQLException
public void setNetworkTimeout(java.util.concurrent.Executor executor, int milliseconds) throws java.sql.SQLException
setNetworkTimeout
in interface java.sql.Connection
java.sql.SQLException
public int getNetworkTimeout() throws java.sql.SQLException
getNetworkTimeout
in interface java.sql.Connection
java.sql.SQLException
public java.sql.Clob createClob()
createClob
in interface java.sql.Connection
public java.sql.Blob createBlob()
createBlob
in interface java.sql.Connection
public java.sql.NClob createNClob()
createNClob
in interface java.sql.Connection
public java.sql.SQLXML createSQLXML() throws java.sql.SQLException
createSQLXML
in interface java.sql.Connection
java.sql.SQLException
public boolean isValid(int timeout) throws java.sql.SQLException
isValid
in interface java.sql.Connection
java.sql.SQLException
public ClientInfoProvider getClientInfoProviderImpl() throws java.sql.SQLException
getClientInfoProviderImpl
in interface JdbcConnection
java.sql.SQLException
public void setClientInfo(java.lang.String name, java.lang.String value) throws java.sql.SQLClientInfoException
setClientInfo
in interface java.sql.Connection
java.sql.SQLClientInfoException
public void setClientInfo(java.util.Properties properties) throws java.sql.SQLClientInfoException
setClientInfo
in interface java.sql.Connection
java.sql.SQLClientInfoException
public java.lang.String getClientInfo(java.lang.String name) throws java.sql.SQLException
getClientInfo
in interface java.sql.Connection
java.sql.SQLException
public java.util.Properties getClientInfo() throws java.sql.SQLException
getClientInfo
in interface java.sql.Connection
java.sql.SQLException
public java.sql.Array createArrayOf(java.lang.String typeName, java.lang.Object[] elements) throws java.sql.SQLException
createArrayOf
in interface java.sql.Connection
java.sql.SQLException
public java.sql.Struct createStruct(java.lang.String typeName, java.lang.Object[] attributes) throws java.sql.SQLException
createStruct
in interface java.sql.Connection
java.sql.SQLException
public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException
unwrap
in interface java.sql.Wrapper
java.sql.SQLException
public boolean isWrapperFor(java.lang.Class<?> iface) throws java.sql.SQLException
isWrapperFor
in interface java.sql.Wrapper
java.sql.SQLException
public NativeSession getSession()
getSession
in interface MysqlConnection
public java.lang.String getHostPortPair()
getHostPortPair
in interface JdbcConnection
public void handleNormalClose()
handleNormalClose
in interface Session.SessionEventListener
public void handleReconnect()
handleReconnect
in interface Session.SessionEventListener
public void handleCleanup(java.lang.Throwable whyCleanedUp)
handleCleanup
in interface Session.SessionEventListener