com.mysql.jdbc
Class Connection

java.lang.Object
  extended bycom.mysql.jdbc.ConnectionProperties
      extended bycom.mysql.jdbc.Connection
All Implemented Interfaces:
java.sql.Connection, java.io.Serializable

public class Connection
extends ConnectionProperties
implements java.sql.Connection

A Connection represents a session with a specific database. Within the context of a Connection, SQL statements are executed and results are returned.

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.

See Also:
Connection, Serialized Form

Nested Class Summary
(package private)  class Connection.CompoundCacheKey
          Used as a key for caching callable statements which (may) depend on current catalog...In 5.0.x, they don't (currently), but stored procedure names soon will, so current catalog is a (hidden) component of the name.
(package private)  class Connection.UltraDevWorkAround
          Wrapper class for UltraDev CallableStatements that are really PreparedStatments.
 
Nested classes inherited from class com.mysql.jdbc.ConnectionProperties
ConnectionProperties.BooleanConnectionProperty, ConnectionProperties.ConnectionProperty, ConnectionProperties.IntegerConnectionProperty, ConnectionProperties.MemorySizeConnectionProperty, ConnectionProperties.StringConnectionProperty
 
Field Summary
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  com.mysql.jdbc.util.LRUCache resultSetMetadataCache
          Cache of ResultSet metadata
 
Fields inherited from class com.mysql.jdbc.ConnectionProperties
ZERO_DATETIME_BEHAVIOR_CONVERT_TO_NULL, ZERO_DATETIME_BEHAVIOR_EXCEPTION, ZERO_DATETIME_BEHAVIOR_ROUND
 
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
 
Constructor Summary
(package private) Connection(java.lang.String hostToConnectTo, int portToConnectTo, java.util.Properties info, java.lang.String databaseToConnectTo, java.lang.String url)
          Creates a connection to a MySQL Server.
 
Method Summary
protected static java.sql.SQLException appendMessageToException(java.sql.SQLException sqlEx, java.lang.String messageToAppend)
           
 void changeUser(java.lang.String userName, java.lang.String newPassword)
          Changes the user on this connection by performing a re-authentication.
 void clearHasTriedMaster()
           
 void clearWarnings()
          After this call, getWarnings returns null until a new warning is reported for this connection.
 PreparedStatement clientPrepareStatement(java.lang.String sql)
          DOCUMENT ME!
 java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql, int autoGenKeyIndex)
           
 PreparedStatement clientPrepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency)
          DOCUMENT ME!
protected  PreparedStatement clientPrepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, boolean processEscapeCodesIfNeeded)
           
 void close()
           
 void commit()
          The method commit() makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by the Connection.
protected  MysqlIO createNewIO(boolean isForReconnect)
          Creates an IO channel to the server
 java.sql.Statement createStatement()
          SQL statements without parameters are normally executed using Statement objects.
 java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency)
          JDBC 2.0 Same as createStatement() above, but allows the default result set type and result set concurrency type to be overridden.
 java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
           
protected  void dumpTestcaseQuery(java.lang.String query)
           
protected  Connection duplicate()
           
(package private)  ResultSet execSQL(Statement callingStatement, java.lang.String sql, int maxRows, Buffer packet, int resultSetType, int resultSetConcurrency, boolean streamResults, java.lang.String catalog, boolean unpackFields)
          Send a query to the server.
(package private)  ResultSet execSQL(Statement callingStatement, java.lang.String sql, int maxRows, Buffer packet, int resultSetType, int resultSetConcurrency, boolean streamResults, java.lang.String catalog, boolean unpackFields, boolean isBatch)
           
protected  java.lang.String extractSqlFromPacket(java.lang.String possibleSqlQuery, Buffer queryPacket, int endOfQueryPacketPosition)
           
protected  void finalize()
          DOCUMENT ME!
protected  java.lang.StringBuffer generateConnectionCommentBlock(java.lang.StringBuffer buf)
           
 int getActiveStatementCount()
           
 boolean getAutoCommit()
          Gets the current auto-commit state
protected  CachedResultSetMetaData getCachedMetaData(java.lang.String sql)
          Returns cached metadata (or null if not cached) for the given query, which must match _exactly_.
protected  java.util.Calendar getCalendarInstanceForSessionOrNew()
          Optimization to only use one calendar per-session, or calculate it for each call, depending on user configuration
protected static java.util.Timer getCancelTimer()
           
 java.lang.String getCatalog()
          Return the connections current catalog name, or null if no catalog name is set, or we dont support catalogs.
protected  java.lang.String getCharacterSetMetadata()
           
(package private)  SingleByteCharsetConverter getCharsetConverter(java.lang.String javaEncodingName)
          Returns the locally mapped instance of a charset converter (to avoid overhead of static synchronization).
protected  java.lang.String getCharsetNameForIndex(int charsetIndex)
          Returns the Java character encoding name for the given MySQL server charset index
protected  java.util.TimeZone getDefaultTimeZone()
          DOCUMENT ME!
protected  java.lang.String getErrorMessageEncoding()
           
 int getHoldability()
           
(package private)  long getId()
           
 long getIdleFor()
          NOT JDBC-Compliant, but clients can use this method to determine how long this connection has been idle.
protected  MysqlIO getIO()
          Returns the IO channel to the server
 com.mysql.jdbc.log.Log getLog()
          Returns the log mechanism that should be used to log information from/for this Connection.
(package private)  int getMaxAllowedPacket()
          Returns the maximum packet size the MySQL server will accept
protected  int getMaxBytesPerChar(java.lang.String javaCharsetName)
           
 java.sql.DatabaseMetaData getMetaData()
          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.
protected  java.sql.Statement getMetadataSafeStatement()
           
(package private)  java.lang.Object getMutex()
          Returns the Mutex all queries are locked against
(package private)  int getNetBufferLength()
          Returns the packet buffer size the MySQL server reported upon connection
protected  java.lang.String getServerCharacterEncoding()
          Returns the server's character set
(package private)  int getServerMajorVersion()
           
(package private)  int getServerMinorVersion()
           
(package private)  int getServerSubMinorVersion()
           
 java.util.TimeZone getServerTimezoneTZ()
          DOCUMENT ME!
(package private)  java.lang.String getServerVariable(java.lang.String variableName)
           
(package private)  java.lang.String getServerVersion()
           
protected  java.util.Calendar getSessionLockedCalendar()
           
 int getTransactionIsolation()
          Get this Connection's current transaction isolation mode.
 java.util.Map getTypeMap()
          JDBC 2.0 Get the type-map object associated with this connection.
(package private)  java.lang.String getURL()
           
(package private)  java.lang.String getUser()
           
protected  java.util.Calendar getUtcCalendar()
           
 java.sql.SQLWarning getWarnings()
          The first warning reported by calls on this Connection is returned.
 boolean hasSameProperties(Connection c)
           
 boolean hasTriedMaster()
           
protected  void incrementNumberOfPreparedExecutes()
           
protected  void incrementNumberOfPrepares()
           
protected  void incrementNumberOfResultSetsCreated()
           
protected  void initializeResultsMetadataFromCache(java.lang.String sql, CachedResultSetMetaData cachedMetaData, ResultSet resultSet)
          Caches CachedResultSetMetaData that has been placed in the cache using the given SQL as a key.
protected  boolean isClientTzUTC()
           
 boolean isClosed()
          DOCUMENT ME!
protected  boolean isCursorFetchEnabled()
           
 boolean isInGlobalTx()
           
 boolean isMasterConnection()
          Is this connection connected to the first host in the list if there is a list of servers in the URL?
 boolean isNoBackslashEscapesSet()
          Is the server in a sql_mode that doesn't allow us to use \\ to escape things?
(package private)  boolean isReadInfoMsgEnabled()
           
 boolean isReadOnly()
          Tests to see if the connection is in Read Only Mode.
protected  boolean isRunningOnJDK13()
           
 boolean isSameResource(Connection otherConnection)
           
protected  boolean isServerTzUTC()
           
 boolean lowerCaseTableNames()
          Is the server configured to use lower-case table names only?
(package private)  void maxRowsChanged(Statement stmt)
          Has the maxRows value changed?
 java.lang.String nativeSQL(java.lang.String sql)
          A driver may convert the JDBC sql grammar into its system's native SQL grammar prior to sending it; nativeSQL returns the native form of the statement that the driver would have sent.
 boolean parserKnowsUnicode()
          DOCUMENT ME!
 void ping()
          Detect if the connection is still good
 java.sql.CallableStatement prepareCall(java.lang.String sql)
          DOCUMENT ME!
 java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency)
          JDBC 2.0 Same as prepareCall() above, but allows the default result set type and result set concurrency type to be overridden.
 java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
           
 java.sql.PreparedStatement prepareStatement(java.lang.String sql)
          A SQL statement with or without IN parameters can be pre-compiled and stored in a PreparedStatement object.
 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)
          JDBC 2.0 Same as prepareStatement() above, but allows the default result set type and result set concurrency type to be overridden.
 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)
           
protected  void realClose(boolean calledExplicitly, boolean issueRollback, boolean skipLocalTeardown, java.lang.Throwable reason)
          Closes connection and frees resources.
protected  void recachePreparedStatement(ServerPreparedStatement pstmt)
           
protected  void registerQueryExecutionTime(long queryTimeMs)
          DOCUMENT ME!
(package private)  void registerStatement(Statement stmt)
          Register a Statement instance as open.
 void releaseSavepoint(java.sql.Savepoint arg0)
           
protected  void reportNumberOfTablesAccessed(int numTablesAccessed)
           
 void resetServerState()
          Resets the server-side state of this connection.
 void rollback()
          The method rollback() drops all changes made since the previous commit/rollback and releases any database locks currently held by the Connection.
 void rollback(java.sql.Savepoint savepoint)
           
 ServerPreparedStatement serverPrepare(java.lang.String sql)
          DOCUMENT ME!
protected  boolean serverSupportsConvertFn()
           
 void setAutoCommit(boolean autoCommitFlag)
          If a connection is in auto-commit mode, than all its SQL statements will be executed and committed as individual transactions.
 void setCatalog(java.lang.String catalog)
          A sub-space of this Connection's database may be selected by setting a catalog name.
 void setFailedOver(boolean flag)
           
 void setHoldability(int arg0)
           
 void setInGlobalTx(boolean flag)
           
 void setPreferSlaveDuringFailover(boolean flag)
           
(package private)  void setReadInfoMsgEnabled(boolean flag)
           
 void setReadOnly(boolean readOnlyFlag)
          You can put a connection in read-only mode as a hint to enable database optimizations Note: setReadOnly cannot be called while in the middle of a transaction
 java.sql.Savepoint setSavepoint()
           
 java.sql.Savepoint setSavepoint(java.lang.String name)
           
 void setTransactionIsolation(int level)
          Attempts to change the transaction isolation level for this Connection object to the one given.
 void setTypeMap(java.util.Map map)
          JDBC 2.0 Install a type-map object as the default type-map for this connection
 void shutdownServer()
          Used by MiniAdmin to shutdown a MySQL server
 boolean supportsIsolationLevel()
          DOCUMENT ME!
 boolean supportsQuotedIdentifiers()
          DOCUMENT ME!
 boolean supportsTransactions()
          DOCUMENT ME!
(package private)  void unregisterStatement(Statement stmt)
          Remove the given statement from the list of open statements
(package private)  void unsetMaxRows(Statement stmt)
          Called by statements on their .close() to let the connection know when it is safe to set the connection back to 'default' row limits.
(package private)  boolean useAnsiQuotedIdentifiers()
           
(package private)  boolean useMaxRows()
          Has maxRows() been set?
 boolean versionMeetsMinimum(int major, int minor, int subminor)
           
 
Methods inherited from class com.mysql.jdbc.ConnectionProperties
exposeAsDriverPropertyInfo, exposeAsDriverPropertyInfoInternal, exposeAsProperties, exposeAsXml, getAllowLoadLocalInfile, getAllowMultiQueries, getAllowNanAndInf, getAllowUrlInLocalInfile, getAlwaysSendSetIsolation, getAutoClosePStmtStreams, getAutoDeserialize, getAutoGenerateTestcaseScript, getAutoReconnectForPools, getBlobSendChunkSize, getCacheCallableStatements, getCacheCallableStmts, getCachePreparedStatements, getCachePrepStmts, getCacheResultSetMetadata, getCacheServerConfiguration, getCallableStatementCacheSize, getCallableStmtCacheSize, getCapitalizeTypeNames, getCharacterSetResults, getClobberStreamingResults, getClobCharacterEncoding, getConnectionCollation, getConnectTimeout, getContinueBatchOnError, getCreateDatabaseIfNotExist, getDefaultFetchSize, getDontTrackOpenResources, getDumpMetadataOnColumnNotFound, getDumpQueriesOnException, getDynamicCalendars, getElideSetAutoCommits, getEmptyStringsConvertToZero, getEmulateLocators, getEmulateUnsupportedPstmts, getEnablePacketDebug, getEncoding, getExplainSlowQueries, getFailOverReadOnly, getGatherPerfMetrics, getGatherPerformanceMetrics, getGenerateSimpleParameterMetadata, getHighAvailability, getHoldResultsOpenOverStatementClose, getIgnoreNonTxTables, getInitialTimeout, getInteractiveClient, getIsInteractiveClient, getJdbcCompliantTruncation, getJdbcCompliantTruncationForReads, getLocalSocketAddress, getLocatorFetchBufferSize, getLogger, getLoggerClassName, getLogSlowQueries, getLogXaCommands, getMaintainTimeStats, getMaxQuerySizeToLog, getMaxReconnects, getMaxRows, getMetadataCacheSize, getNoAccessToProcedureBodies, getNoDatetimeStringSync, getNoTimezoneConversionForTimeType, getNullCatalogMeansCurrent, getNullNamePatternMatchesAll, getOverrideSupportsIntegrityEnhancementFacility, getPacketDebugBufferSize, getParanoid, getPedantic, getPinGlobalTxToPhysicalConnection, getPreparedStatementCacheSize, getPreparedStatementCacheSqlLimit, getPrepStmtCacheSize, getPrepStmtCacheSqlLimit, getProcessEscapeCodesForPrepStmts, getProfileSql, getProfileSQL, getPropertiesTransform, getQueriesBeforeRetryMaster, getReconnectAtTxEnd, getRelaxAutoCommit, getReportMetricsIntervalMillis, getRequireSSL, getResourceId, getResultSetSizeThreshold, getRetainStatementAfterResultSetClose, getRewriteBatchedStatements, getRollbackOnPooledClose, getRoundRobinLoadBalance, getRunningCTS13, getSecondsBeforeRetryMaster, getServerTimezone, getSessionVariables, getSlowQueryThresholdMillis, getSocketFactory, getSocketFactoryClassName, getSocketTimeout, getStrictFloatingPoint, getStrictUpdates, getTinyInt1isBit, getTraceProtocol, getTransformedBitIsBoolean, getTreatUtilDateAsTimestamp, getUltraDevHack, getUseCompression, getUseConfigs, getUseCursorFetch, getUseFastDateParsing, getUseFastIntParsing, getUseGmtMillisForDatetimes, getUseHostsInPrivileges, getUseInformationSchema, getUseJDBCCompliantTimezoneShift, getUseJvmCharsetConverters, getUseLocalSessionState, getUseOldAliasMetadataBehavior, getUseOldUTF8Behavior, getUseOnlyServerErrorMessages, getUseReadAheadInput, getUseServerPreparedStmts, getUseServerPrepStmts, getUseSqlStateCodes, getUseSSL, getUseSSPSCompatibleTimezoneShift, getUseStreamLengthsInPrepStmts, getUseTimezone, getUseUltraDevWorkAround, getUseUnbufferedInput, getUseUnicode, getUseUsageAdvisor, getYearIsDateType, getZeroDateTimeBehavior, initializeFromRef, initializeProperties, postInitialization, setAllowLoadLocalInfile, setAllowMultiQueries, setAllowNanAndInf, setAllowUrlInLocalInfile, setAlwaysSendSetIsolation, setAutoClosePStmtStreams, setAutoDeserialize, setAutoGenerateTestcaseScript, setAutoReconnect, setAutoReconnectForConnectionPools, setAutoReconnectForPools, setBlobSendChunkSize, setCacheCallableStatements, setCacheCallableStmts, setCachePreparedStatements, setCachePrepStmts, setCacheResultSetMetadata, setCacheServerConfiguration, setCallableStatementCacheSize, setCallableStmtCacheSize, setCapitalizeDBMDTypes, setCapitalizeTypeNames, setCharacterEncoding, setCharacterSetResults, setClobberStreamingResults, setClobCharacterEncoding, setConnectionCollation, setConnectTimeout, setContinueBatchOnError, setCreateDatabaseIfNotExist, setDefaultFetchSize, setDetectServerPreparedStmts, setDontTrackOpenResources, setDumpMetadataOnColumnNotFound, setDumpQueriesOnException, setDynamicCalendars, setElideSetAutoCommits, setEmptyStringsConvertToZero, setEmulateLocators, setEmulateUnsupportedPstmts, setEnablePacketDebug, setEncoding, setExplainSlowQueries, setFailOverReadOnly, setGatherPerfMetrics, setGatherPerformanceMetrics, setGenerateSimpleParameterMetadata, setHighAvailability, setHoldResultsOpenOverStatementClose, setIgnoreNonTxTables, setInitialTimeout, setInteractiveClient, setIsInteractiveClient, setJdbcCompliantTruncation, setJdbcCompliantTruncationForReads, setLocalSocketAddress, setLocatorFetchBufferSize, setLogger, setLoggerClassName, setLogSlowQueries, setLogXaCommands, setMaintainTimeStats, setMaxQuerySizeToLog, setMaxReconnects, setMaxRows, setMetadataCacheSize, setNoAccessToProcedureBodies, setNoDatetimeStringSync, setNoTimezoneConversionForTimeType, setNullCatalogMeansCurrent, setNullNamePatternMatchesAll, setOverrideSupportsIntegrityEnhancementFacility, setPacketDebugBufferSize, setParanoid, setPedantic, setPinGlobalTxToPhysicalConnection, setPreparedStatementCacheSize, setPreparedStatementCacheSqlLimit, setPrepStmtCacheSize, setPrepStmtCacheSqlLimit, setProcessEscapeCodesForPrepStmts, setProfileSql, setProfileSQL, setPropertiesTransform, setQueriesBeforeRetryMaster, setReconnectAtTxEnd, setRelaxAutoCommit, setReportMetricsIntervalMillis, setRequireSSL, setResourceId, setResultSetSizeThreshold, setRetainStatementAfterResultSetClose, setRewriteBatchedStatements, setRollbackOnPooledClose, setRoundRobinLoadBalance, setRunningCTS13, setSecondsBeforeRetryMaster, setServerTimezone, setSessionVariables, setSlowQueryThresholdMillis, setSocketFactory, setSocketFactoryClassName, setSocketTimeout, setStrictFloatingPoint, setStrictUpdates, setTinyInt1isBit, setTraceProtocol, setTransformedBitIsBoolean, setTreatUtilDateAsTimestamp, setUltraDevHack, setUseCompression, setUseConfigs, setUseCursorFetch, setUseFastDateParsing, setUseFastIntParsing, setUseGmtMillisForDatetimes, setUseHostsInPrivileges, setUseInformationSchema, setUseJDBCCompliantTimezoneShift, setUseJvmCharsetConverters, setUseLocalSessionState, setUseOldAliasMetadataBehavior, setUseOldUTF8Behavior, setUseOnlyServerErrorMessages, setUseReadAheadInput, setUseServerPreparedStmts, setUseServerPrepStmts, setUseSqlStateCodes, setUseSSL, setUseSSPSCompatibleTimezoneShift, setUseStreamLengthsInPrepStmts, setUseTimezone, setUseUltraDevWorkAround, setUseUnbufferedInput, setUseUnicode, setUseUsageAdvisor, setYearIsDateType, setZeroDateTimeBehavior, storeToRef, useUnbufferedInput
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

charsetMap

public static java.util.Map charsetMap
The mapping between MySQL charset names and Java charset names. Initialized by loadCharacterSetMapping()


DEFAULT_LOGGER_CLASS

protected static final java.lang.String DEFAULT_LOGGER_CLASS
Default logger class name

See Also:
Constant Field Values

resultSetMetadataCache

protected com.mysql.jdbc.util.LRUCache resultSetMetadataCache
Cache of ResultSet metadata

Constructor Detail

Connection

Connection(java.lang.String hostToConnectTo,
           int portToConnectTo,
           java.util.Properties info,
           java.lang.String databaseToConnectTo,
           java.lang.String url)
     throws java.sql.SQLException
Creates a connection to a MySQL Server.

Parameters:
hostToConnectTo - the hostname of the database server
portToConnectTo - the port number the server is listening on
info - a Properties[] list holding the user and password
databaseToConnectTo - the database to connect to
url - the URL of the connection
Throws:
java.sql.SQLException - if a database access error occurs
Method Detail

appendMessageToException

protected static java.sql.SQLException appendMessageToException(java.sql.SQLException sqlEx,
                                                                java.lang.String messageToAppend)

getCancelTimer

protected static java.util.Timer getCancelTimer()

changeUser

public void changeUser(java.lang.String userName,
                       java.lang.String newPassword)
                throws java.sql.SQLException
Changes the user on this connection by performing a re-authentication. If authentication fails, the connection will remain under the context of the current user.

Parameters:
userName - the username to authenticate with
newPassword - the password to authenticate with
Throws:
java.sql.SQLException - if authentication fails, or some other error occurs while performing the command.

clearWarnings

public void clearWarnings()
                   throws java.sql.SQLException
After this call, getWarnings returns null until a new warning is reported for this connection.

Specified by:
clearWarnings in interface java.sql.Connection
Throws:
java.sql.SQLException - if a database access error occurs

clientPrepareStatement

public PreparedStatement clientPrepareStatement(java.lang.String sql)
                                         throws java.sql.SQLException
DOCUMENT ME!

Parameters:
sql - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.sql.SQLException - DOCUMENT ME!

clientPrepareStatement

public java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql,
                                                         int autoGenKeyIndex)
                                                  throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
prepareStatement(String, int)

clientPrepareStatement

public PreparedStatement clientPrepareStatement(java.lang.String sql,
                                                int resultSetType,
                                                int resultSetConcurrency)
                                         throws java.sql.SQLException
DOCUMENT ME!

Parameters:
sql - DOCUMENT ME!
resultSetType - DOCUMENT ME!
resultSetConcurrency - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.sql.SQLException - DOCUMENT ME!

clientPrepareStatement

protected PreparedStatement clientPrepareStatement(java.lang.String sql,
                                                   int resultSetType,
                                                   int resultSetConcurrency,
                                                   boolean processEscapeCodesIfNeeded)
                                            throws java.sql.SQLException
Throws:
java.sql.SQLException

close

public void close()
           throws java.sql.SQLException
Specified by:
close in interface java.sql.Connection
Throws:
java.sql.SQLException

commit

public void commit()
            throws java.sql.SQLException
The method commit() makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by the Connection. This method should only be used when auto-commit has been disabled.

Note: MySQL does not support transactions, so this method is a no-op.

Specified by:
commit in interface java.sql.Connection
Throws:
java.sql.SQLException - if a database access error occurs
See Also:
setAutoCommit

createNewIO

protected MysqlIO createNewIO(boolean isForReconnect)
                       throws java.sql.SQLException
Creates an IO channel to the server

Parameters:
isForReconnect - is this request for a re-connect
Returns:
a new MysqlIO instance connected to a server
Throws:
java.sql.SQLException - if a database access error occurs
CommunicationsException - DOCUMENT ME!

createStatement

public java.sql.Statement createStatement()
                                   throws java.sql.SQLException
SQL statements without parameters are normally executed using Statement objects. If the same SQL statement is executed many times, it is more efficient to use a PreparedStatement

Specified by:
createStatement in interface java.sql.Connection
Returns:
a new Statement object
Throws:
java.sql.SQLException - passed through from the constructor

createStatement

public java.sql.Statement createStatement(int resultSetType,
                                          int resultSetConcurrency)
                                   throws java.sql.SQLException
JDBC 2.0 Same as createStatement() above, but allows the default result set type and result set concurrency type to be overridden.

Specified by:
createStatement in interface java.sql.Connection
Parameters:
resultSetType - a result set type, see ResultSet.TYPE_XXX
resultSetConcurrency - a concurrency type, see ResultSet.CONCUR_XXX
Returns:
a new Statement object
Throws:
java.sql.SQLException - if a database-access error occurs.

createStatement

public java.sql.Statement createStatement(int resultSetType,
                                          int resultSetConcurrency,
                                          int resultSetHoldability)
                                   throws java.sql.SQLException
Specified by:
createStatement in interface java.sql.Connection
Throws:
java.sql.SQLException
See Also:
createStatement(int, int, int)

dumpTestcaseQuery

protected void dumpTestcaseQuery(java.lang.String query)

duplicate

protected Connection duplicate()
                        throws java.sql.SQLException
Throws:
java.sql.SQLException

execSQL

ResultSet execSQL(Statement callingStatement,
                  java.lang.String sql,
                  int maxRows,
                  Buffer packet,
                  int resultSetType,
                  int resultSetConcurrency,
                  boolean streamResults,
                  java.lang.String catalog,
                  boolean unpackFields)
            throws java.sql.SQLException
Send a query to the server. Returns one of the ResultSet objects. This is synchronized, so Statement's queries will be serialized.

Parameters:
callingStatement - DOCUMENT ME!
sql - the SQL statement to be executed
maxRows - DOCUMENT ME!
packet - DOCUMENT ME!
resultSetType - DOCUMENT ME!
resultSetConcurrency - DOCUMENT ME!
streamResults - DOCUMENT ME!
catalog - DOCUMENT ME!
unpackFields - DOCUMENT ME!
Returns:
a ResultSet holding the results
Throws:
java.sql.SQLException - if a database error occurs

execSQL

ResultSet execSQL(Statement callingStatement,
                  java.lang.String sql,
                  int maxRows,
                  Buffer packet,
                  int resultSetType,
                  int resultSetConcurrency,
                  boolean streamResults,
                  java.lang.String catalog,
                  boolean unpackFields,
                  boolean isBatch)
            throws java.sql.SQLException
Throws:
java.sql.SQLException

extractSqlFromPacket

protected java.lang.String extractSqlFromPacket(java.lang.String possibleSqlQuery,
                                                Buffer queryPacket,
                                                int endOfQueryPacketPosition)
                                         throws java.sql.SQLException
Throws:
java.sql.SQLException

finalize

protected void finalize()
                 throws java.lang.Throwable
DOCUMENT ME!

Throws:
java.lang.Throwable - DOCUMENT ME!

generateConnectionCommentBlock

protected java.lang.StringBuffer generateConnectionCommentBlock(java.lang.StringBuffer buf)

getActiveStatementCount

public int getActiveStatementCount()

getAutoCommit

public boolean getAutoCommit()
                      throws java.sql.SQLException
Gets the current auto-commit state

Specified by:
getAutoCommit in interface java.sql.Connection
Returns:
Current state of auto-commit
Throws:
java.sql.SQLException - if an error occurs
See Also:
setAutoCommit

getCalendarInstanceForSessionOrNew

protected java.util.Calendar getCalendarInstanceForSessionOrNew()
Optimization to only use one calendar per-session, or calculate it for each call, depending on user configuration


getCatalog

public java.lang.String getCatalog()
                            throws java.sql.SQLException
Return the connections current catalog name, or null if no catalog name is set, or we dont support catalogs.

Note: MySQL's notion of catalogs are individual databases.

Specified by:
getCatalog in interface java.sql.Connection
Returns:
the current catalog name or null
Throws:
java.sql.SQLException - if a database access error occurs

getCharacterSetMetadata

protected java.lang.String getCharacterSetMetadata()
Returns:
Returns the characterSetMetadata.

getCharsetConverter

SingleByteCharsetConverter getCharsetConverter(java.lang.String javaEncodingName)
                                         throws java.sql.SQLException
Returns the locally mapped instance of a charset converter (to avoid overhead of static synchronization).

Parameters:
javaEncodingName - the encoding name to retrieve
Returns:
a character converter, or null if one couldn't be mapped.
Throws:
java.sql.SQLException

getCharsetNameForIndex

protected java.lang.String getCharsetNameForIndex(int charsetIndex)
                                           throws java.sql.SQLException
Returns the Java character encoding name for the given MySQL server charset index

Parameters:
charsetIndex -
Returns:
the Java character encoding name for the given MySQL server charset index
Throws:
java.sql.SQLException - if the character set index isn't known by the driver

getDefaultTimeZone

protected java.util.TimeZone getDefaultTimeZone()
DOCUMENT ME!

Returns:
Returns the defaultTimeZone.

getHoldability

public int getHoldability()
                   throws java.sql.SQLException
Specified by:
getHoldability in interface java.sql.Connection
Throws:
java.sql.SQLException
See Also:
getHoldability()

getId

long getId()

getIdleFor

public long getIdleFor()
NOT JDBC-Compliant, but clients can use this method to determine how long this connection has been idle. This time (reported in milliseconds) is updated once a query has completed.

Returns:
number of ms that this connection has been idle, 0 if the driver is busy retrieving results.

getIO

protected MysqlIO getIO()
                 throws java.sql.SQLException
Returns the IO channel to the server

Returns:
the IO channel to the server
Throws:
java.sql.SQLException - if the connection is closed.

getLog

public com.mysql.jdbc.log.Log getLog()
                              throws java.sql.SQLException
Returns the log mechanism that should be used to log information from/for this Connection.

Returns:
the Log instance to use for logging messages.
Throws:
java.sql.SQLException - if an error occurs

getMaxAllowedPacket

int getMaxAllowedPacket()
Returns the maximum packet size the MySQL server will accept

Returns:
DOCUMENT ME!

getMaxBytesPerChar

protected int getMaxBytesPerChar(java.lang.String javaCharsetName)
                          throws java.sql.SQLException
Throws:
java.sql.SQLException

getMetaData

public java.sql.DatabaseMetaData getMetaData()
                                      throws java.sql.SQLException
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 made available through a DatabaseMetaData object.

Specified by:
getMetaData in interface java.sql.Connection
Returns:
a DatabaseMetaData object for this connection
Throws:
java.sql.SQLException - if a database access error occurs

getMetadataSafeStatement

protected java.sql.Statement getMetadataSafeStatement()
                                               throws java.sql.SQLException
Throws:
java.sql.SQLException

getMutex

java.lang.Object getMutex()
                    throws java.sql.SQLException
Returns the Mutex all queries are locked against

Returns:
DOCUMENT ME!
Throws:
java.sql.SQLException - DOCUMENT ME!

getNetBufferLength

int getNetBufferLength()
Returns the packet buffer size the MySQL server reported upon connection

Returns:
DOCUMENT ME!

getServerCharacterEncoding

protected java.lang.String getServerCharacterEncoding()
Returns the server's character set

Returns:
the server's character set.

getServerMajorVersion

int getServerMajorVersion()

getServerMinorVersion

int getServerMinorVersion()

getServerSubMinorVersion

int getServerSubMinorVersion()

getServerTimezoneTZ

public java.util.TimeZone getServerTimezoneTZ()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getServerVariable

java.lang.String getServerVariable(java.lang.String variableName)

getServerVersion

java.lang.String getServerVersion()

getSessionLockedCalendar

protected java.util.Calendar getSessionLockedCalendar()

getTransactionIsolation

public int getTransactionIsolation()
                            throws java.sql.SQLException
Get this Connection's current transaction isolation mode.

Specified by:
getTransactionIsolation in interface java.sql.Connection
Returns:
the current TRANSACTION_ mode value
Throws:
java.sql.SQLException - if a database access error occurs

getTypeMap

public java.util.Map getTypeMap()
                         throws java.sql.SQLException
JDBC 2.0 Get the type-map object associated with this connection. By default, the map returned is empty.

Specified by:
getTypeMap in interface java.sql.Connection
Returns:
the type map
Throws:
java.sql.SQLException - if a database error occurs

getURL

java.lang.String getURL()

getUser

java.lang.String getUser()

getUtcCalendar

protected java.util.Calendar getUtcCalendar()

getWarnings

public java.sql.SQLWarning getWarnings()
                                throws java.sql.SQLException
The first warning reported by calls on this Connection is returned. Note: Sebsequent warnings will be changed to this java.sql.SQLWarning

Specified by:
getWarnings in interface java.sql.Connection
Returns:
the first java.sql.SQLWarning or null
Throws:
java.sql.SQLException - if a database access error occurs

hasSameProperties

public boolean hasSameProperties(Connection c)

incrementNumberOfPreparedExecutes

protected void incrementNumberOfPreparedExecutes()

incrementNumberOfPrepares

protected void incrementNumberOfPrepares()

incrementNumberOfResultSetsCreated

protected void incrementNumberOfResultSetsCreated()

isClientTzUTC

protected boolean isClientTzUTC()

isClosed

public boolean isClosed()
DOCUMENT ME!

Specified by:
isClosed in interface java.sql.Connection
Returns:
DOCUMENT ME!

isCursorFetchEnabled

protected boolean isCursorFetchEnabled()
                                throws java.sql.SQLException
Throws:
java.sql.SQLException

isInGlobalTx

public boolean isInGlobalTx()

isMasterConnection

public boolean isMasterConnection()
Is this connection connected to the first host in the list if there is a list of servers in the URL?

Returns:
true if this connection is connected to the first in the list.

isNoBackslashEscapesSet

public boolean isNoBackslashEscapesSet()
Is the server in a sql_mode that doesn't allow us to use \\ to escape things?

Returns:
Returns the noBackslashEscapes.

isReadInfoMsgEnabled

boolean isReadInfoMsgEnabled()

isReadOnly

public boolean isReadOnly()
                   throws java.sql.SQLException
Tests to see if the connection is in Read Only Mode. Note that we cannot really put the database in read only mode, but we pretend we can by returning the value of the readOnly flag

Specified by:
isReadOnly in interface java.sql.Connection
Returns:
true if the connection is read only
Throws:
java.sql.SQLException - if a database access error occurs

isRunningOnJDK13

protected boolean isRunningOnJDK13()

isSameResource

public boolean isSameResource(Connection otherConnection)

isServerTzUTC

protected boolean isServerTzUTC()

lowerCaseTableNames

public boolean lowerCaseTableNames()
Is the server configured to use lower-case table names only?

Returns:
true if lower_case_table_names is 'on'

maxRowsChanged

void maxRowsChanged(Statement stmt)
Has the maxRows value changed?

Parameters:
stmt - DOCUMENT ME!

nativeSQL

public java.lang.String nativeSQL(java.lang.String sql)
                           throws java.sql.SQLException
A driver may convert the JDBC sql grammar into its system's native SQL grammar prior to sending it; nativeSQL returns the native form of the statement that the driver would have sent.

Specified by:
nativeSQL in interface java.sql.Connection
Parameters:
sql - a SQL statement that may contain one or more '?' parameter placeholders
Returns:
the native form of this statement
Throws:
java.sql.SQLException - if a database access error occurs

parserKnowsUnicode

public boolean parserKnowsUnicode()
DOCUMENT ME!

Returns:
DOCUMENT ME!

ping

public void ping()
          throws java.sql.SQLException
Detect if the connection is still good

Throws:
java.sql.SQLException - if the ping fails

prepareCall

public java.sql.CallableStatement prepareCall(java.lang.String sql)
                                       throws java.sql.SQLException
DOCUMENT ME!

Specified by:
prepareCall in interface java.sql.Connection
Parameters:
sql - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.sql.SQLException - DOCUMENT ME!

prepareCall

public java.sql.CallableStatement prepareCall(java.lang.String sql,
                                              int resultSetType,
                                              int resultSetConcurrency)
                                       throws java.sql.SQLException
JDBC 2.0 Same as prepareCall() above, but allows the default result set type and result set concurrency type to be overridden.

Specified by:
prepareCall in interface java.sql.Connection
Parameters:
sql - the SQL representing the callable statement
resultSetType - a result set type, see ResultSet.TYPE_XXX
resultSetConcurrency - a concurrency type, see ResultSet.CONCUR_XXX
Returns:
a new CallableStatement object containing the pre-compiled SQL statement
Throws:
java.sql.SQLException - if a database-access error occurs.

prepareCall

public java.sql.CallableStatement prepareCall(java.lang.String sql,
                                              int resultSetType,
                                              int resultSetConcurrency,
                                              int resultSetHoldability)
                                       throws java.sql.SQLException
Specified by:
prepareCall in interface java.sql.Connection
Throws:
java.sql.SQLException
See Also:
prepareCall(String, int, int, int)

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql)
                                            throws java.sql.SQLException
A SQL statement with or without IN parameters can be pre-compiled and stored in a PreparedStatement object. This object can then be used to efficiently execute this statement multiple times.

Note: This method is optimized for handling parametric SQL statements that benefit from precompilation if the driver supports precompilation. In this case, the statement is not sent to the database until the PreparedStatement is executed. This has no direct effect on users; however it does affect which method throws certain java.sql.SQLExceptions

MySQL does not support precompilation of statements, so they are handled by the driver.

Specified by:
prepareStatement in interface java.sql.Connection
Parameters:
sql - a SQL statement that may contain one or more '?' IN parameter placeholders
Returns:
a new PreparedStatement object containing the pre-compiled statement.
Throws:
java.sql.SQLException - if a database access error occurs.

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   int autoGenKeyIndex)
                                            throws java.sql.SQLException
Specified by:
prepareStatement in interface java.sql.Connection
Throws:
java.sql.SQLException
See Also:
prepareStatement(String, int)

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   int resultSetType,
                                                   int resultSetConcurrency)
                                            throws java.sql.SQLException
JDBC 2.0 Same as prepareStatement() above, but allows the default result set type and result set concurrency type to be overridden.

Specified by:
prepareStatement in interface java.sql.Connection
Parameters:
sql - the SQL query containing place holders
resultSetType - a result set type, see ResultSet.TYPE_XXX
resultSetConcurrency - a concurrency type, see ResultSet.CONCUR_XXX
Returns:
a new PreparedStatement object containing the pre-compiled SQL statement
Throws:
java.sql.SQLException - if a database-access error occurs.

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   int resultSetType,
                                                   int resultSetConcurrency,
                                                   int resultSetHoldability)
                                            throws java.sql.SQLException
Specified by:
prepareStatement in interface java.sql.Connection
Throws:
java.sql.SQLException
See Also:
prepareStatement(String, int, int, int)

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   int[] autoGenKeyIndexes)
                                            throws java.sql.SQLException
Specified by:
prepareStatement in interface java.sql.Connection
Throws:
java.sql.SQLException
See Also:
prepareStatement(String, int[])

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   java.lang.String[] autoGenKeyColNames)
                                            throws java.sql.SQLException
Specified by:
prepareStatement in interface java.sql.Connection
Throws:
java.sql.SQLException
See Also:
prepareStatement(String, String[])

realClose

protected void realClose(boolean calledExplicitly,
                         boolean issueRollback,
                         boolean skipLocalTeardown,
                         java.lang.Throwable reason)
                  throws java.sql.SQLException
Closes connection and frees resources.

Parameters:
calledExplicitly - is this being called from close()
issueRollback - should a rollback() be issued?
Throws:
java.sql.SQLException - if an error occurs

recachePreparedStatement

protected void recachePreparedStatement(ServerPreparedStatement pstmt)

registerQueryExecutionTime

protected void registerQueryExecutionTime(long queryTimeMs)
DOCUMENT ME!

Parameters:
queryTimeMs -

registerStatement

void registerStatement(Statement stmt)
Register a Statement instance as open.

Parameters:
stmt - the Statement instance to remove

releaseSavepoint

public void releaseSavepoint(java.sql.Savepoint arg0)
                      throws java.sql.SQLException
Specified by:
releaseSavepoint in interface java.sql.Connection
Throws:
java.sql.SQLException
See Also:
releaseSavepoint(Savepoint)

reportNumberOfTablesAccessed

protected void reportNumberOfTablesAccessed(int numTablesAccessed)

resetServerState

public void resetServerState()
                      throws java.sql.SQLException
Resets the server-side state of this connection. Doesn't work for MySQL versions older than 4.0.6 or if isParanoid() is set (it will become a no-op in these cases). Usually only used from connection pooling code.

Throws:
java.sql.SQLException - if the operation fails while resetting server state.

rollback

public void rollback()
              throws java.sql.SQLException
The method rollback() drops all changes made since the previous commit/rollback and releases any database locks currently held by the Connection.

Specified by:
rollback in interface java.sql.Connection
Throws:
java.sql.SQLException - if a database access error occurs
See Also:
commit

rollback

public void rollback(java.sql.Savepoint savepoint)
              throws java.sql.SQLException
Specified by:
rollback in interface java.sql.Connection
Throws:
java.sql.SQLException
See Also:
rollback(Savepoint)

serverPrepare

public ServerPreparedStatement serverPrepare(java.lang.String sql)
                                      throws java.sql.SQLException
DOCUMENT ME!

Parameters:
sql - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.sql.SQLException - DOCUMENT ME!

serverSupportsConvertFn

protected boolean serverSupportsConvertFn()
                                   throws java.sql.SQLException
Throws:
java.sql.SQLException

setAutoCommit

public void setAutoCommit(boolean autoCommitFlag)
                   throws java.sql.SQLException
If a connection is in auto-commit mode, than all its SQL statements will be executed and committed as individual transactions. Otherwise, its SQL statements are grouped into transactions that are terminated by either commit() or rollback(). By default, new connections are in auto- commit mode. The commit occurs when the statement completes or the next execute occurs, whichever comes first. In the case of statements returning a ResultSet, the statement completes when the last row of the ResultSet has been retrieved or the ResultSet has been closed. In advanced cases, a single statement may return multiple results as well as output parameter values. Here the commit occurs when all results and output param values have been retrieved.

Note: MySQL does not support transactions, so this method is a no-op.

Specified by:
setAutoCommit in interface java.sql.Connection
Parameters:
autoCommitFlag - - true enables auto-commit; false disables it
Throws:
java.sql.SQLException - if a database access error occurs

setCatalog

public void setCatalog(java.lang.String catalog)
                throws java.sql.SQLException
A sub-space of this Connection's database may be selected by setting a catalog name. If the driver does not support catalogs, it will silently ignore this request

Note: MySQL's notion of catalogs are individual databases.

Specified by:
setCatalog in interface java.sql.Connection
Parameters:
catalog - the database for this connection to use
Throws:
java.sql.SQLException - if a database access error occurs

setFailedOver

public void setFailedOver(boolean flag)

setHoldability

public void setHoldability(int arg0)
                    throws java.sql.SQLException
Specified by:
setHoldability in interface java.sql.Connection
Throws:
java.sql.SQLException
See Also:
setHoldability(int)

setInGlobalTx

public void setInGlobalTx(boolean flag)

setPreferSlaveDuringFailover

public void setPreferSlaveDuringFailover(boolean flag)

setReadInfoMsgEnabled

void setReadInfoMsgEnabled(boolean flag)

setReadOnly

public void setReadOnly(boolean readOnlyFlag)
                 throws java.sql.SQLException
You can put a connection in read-only mode as a hint to enable database optimizations Note: setReadOnly cannot be called while in the middle of a transaction

Specified by:
setReadOnly in interface java.sql.Connection
Parameters:
readOnlyFlag - - true enables read-only mode; false disables it
Throws:
java.sql.SQLException - if a database access error occurs

setSavepoint

public java.sql.Savepoint setSavepoint()
                                throws java.sql.SQLException
Specified by:
setSavepoint in interface java.sql.Connection
Throws:
java.sql.SQLException
See Also:
setSavepoint()

setSavepoint

public java.sql.Savepoint setSavepoint(java.lang.String name)
                                throws java.sql.SQLException
Specified by:
setSavepoint in interface java.sql.Connection
Throws:
java.sql.SQLException
See Also:
setSavepoint(String)

setTransactionIsolation

public void setTransactionIsolation(int level)
                             throws java.sql.SQLException
Attempts to change the transaction isolation level for this Connection object to the one given. The constants defined in the interface Connection are the possible transaction isolation levels.

Note: If this method is called during a transaction, the result is implementation-defined.

Specified by:
setTransactionIsolation in interface java.sql.Connection
Parameters:
level - one of the following Connection constants: Connection.TRANSACTION_READ_UNCOMMITTED, Connection.TRANSACTION_READ_COMMITTED, Connection.TRANSACTION_REPEATABLE_READ, or Connection.TRANSACTION_SERIALIZABLE. (Note that Connection.TRANSACTION_NONE cannot be used because it specifies that transactions are not supported.)
Throws:
java.sql.SQLException - if a database access error occurs or the given parameter is not one of the Connection constants
See Also:
DatabaseMetaData.supportsTransactionIsolationLevel(int), getTransactionIsolation()

setTypeMap

public void setTypeMap(java.util.Map map)
                throws java.sql.SQLException
JDBC 2.0 Install a type-map object as the default type-map for this connection

Specified by:
setTypeMap in interface java.sql.Connection
Parameters:
map - the type mapping
Throws:
java.sql.SQLException - if a database error occurs.

shutdownServer

public void shutdownServer()
                    throws java.sql.SQLException
Used by MiniAdmin to shutdown a MySQL server

Throws:
java.sql.SQLException - if the command can not be issued.

supportsIsolationLevel

public boolean supportsIsolationLevel()
DOCUMENT ME!

Returns:
DOCUMENT ME!

supportsQuotedIdentifiers

public boolean supportsQuotedIdentifiers()
DOCUMENT ME!

Returns:
DOCUMENT ME!

supportsTransactions

public boolean supportsTransactions()
DOCUMENT ME!

Returns:
DOCUMENT ME!

unregisterStatement

void unregisterStatement(Statement stmt)
Remove the given statement from the list of open statements

Parameters:
stmt - the Statement instance to remove

unsetMaxRows

void unsetMaxRows(Statement stmt)
            throws java.sql.SQLException
Called by statements on their .close() to let the connection know when it is safe to set the connection back to 'default' row limits.

Parameters:
stmt - the statement releasing it's max-rows requirement
Throws:
java.sql.SQLException - if a database error occurs issuing the statement that sets the limit default.

useAnsiQuotedIdentifiers

boolean useAnsiQuotedIdentifiers()

useMaxRows

boolean useMaxRows()
Has maxRows() been set?

Returns:
DOCUMENT ME!

versionMeetsMinimum

public boolean versionMeetsMinimum(int major,
                                   int minor,
                                   int subminor)
                            throws java.sql.SQLException
Throws:
java.sql.SQLException

getErrorMessageEncoding

protected java.lang.String getErrorMessageEncoding()

clearHasTriedMaster

public void clearHasTriedMaster()

hasTriedMaster

public boolean hasTriedMaster()

getCachedMetaData

protected CachedResultSetMetaData getCachedMetaData(java.lang.String sql)
Returns cached metadata (or null if not cached) for the given query, which must match _exactly_. This method is synchronized by the caller on getMutex(), so if calling this method from internal code in the driver, make sure it's synchronized on the mutex that guards communication with the server.

Parameters:
sql - the query that is the key to the cache
Returns:
metadata cached for the given SQL, or none if it doesn't exist.

initializeResultsMetadataFromCache

protected void initializeResultsMetadataFromCache(java.lang.String sql,
                                                  CachedResultSetMetaData cachedMetaData,
                                                  ResultSet resultSet)
                                           throws java.sql.SQLException
Caches CachedResultSetMetaData that has been placed in the cache using the given SQL as a key. This method is synchronized by the caller on getMutex(), so if calling this method from internal code in the driver, make sure it's synchronized on the mutex that guards communication with the server.

Parameters:
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.
Throws:
java.sql.SQLException