com.mysql.jdbc
Class ConnectionImpl

java.lang.Object
  extended by com.mysql.jdbc.ConnectionPropertiesImpl
      extended by com.mysql.jdbc.ConnectionImpl
All Implemented Interfaces:
ConnectionProperties, java.io.Serializable, java.sql.Connection, java.sql.Wrapper
Direct Known Subclasses:
JDBC4Connection

public class ConnectionImpl
extends ConnectionPropertiesImpl
implements 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 ConnectionImpl.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 ConnectionImpl.ExceptionInterceptorChain
           
 
Nested classes/interfaces inherited from class com.mysql.jdbc.ConnectionPropertiesImpl
ConnectionPropertiesImpl.BooleanConnectionProperty, ConnectionPropertiesImpl.ConnectionProperty, ConnectionPropertiesImpl.IntegerConnectionProperty, ConnectionPropertiesImpl.LongConnectionProperty, ConnectionPropertiesImpl.MemorySizeConnectionProperty, ConnectionPropertiesImpl.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  java.util.Properties props
          Properties for this connection specified by user
protected  com.mysql.jdbc.util.LRUCache resultSetMetadataCache
          Cache of ResultSet metadata
 
Fields inherited from class com.mysql.jdbc.ConnectionPropertiesImpl
largeRowSizeThreshold, 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
protected ConnectionImpl()
          ' For the delegate only
protected ConnectionImpl(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  void abortInternal()
          Clobbers the physical network connection and marks this connection as closed.
protected static java.sql.SQLException appendMessageToException(java.sql.SQLException sqlEx, java.lang.String messageToAppend, ExceptionInterceptor interceptor)
           
 void changeUser(java.lang.String userName, java.lang.String newPassword)
          Changes the user on this connection by performing a re-authentication.
protected  void checkClosed()
           
 void clearHasTriedMaster()
           
 void clearWarnings()
          After this call, getWarnings returns null until a new warning is reported for this connection.
 java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql)
          DOCUMENT ME!
 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)
          DOCUMENT ME!
protected  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()
          In some cases, it is desirable to immediately release a Connection's database and JDBC resources instead of waiting for them to be automatically released (cant think why off the top of my head) Note: A Connection is automatically closed when it is garbage collected.
 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  void 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)  ResultSetInternalMethods execSQL(StatementImpl callingStatement, java.lang.String sql, int maxRows, Buffer packet, int resultSetType, int resultSetConcurrency, boolean streamResults, java.lang.String catalog, Field[] cachedMetadata)
          Send a query to the server.
(package private)  ResultSetInternalMethods execSQL(StatementImpl callingStatement, java.lang.String sql, int maxRows, Buffer packet, int resultSetType, int resultSetConcurrency, boolean streamResults, java.lang.String catalog, Field[] cachedMetadata, 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()
          Returns the number of statements active on this connection, which haven't been .close()d.
 boolean getAutoCommit()
          Gets the current auto-commit state
 int getAutoIncrementIncrement()
          Returns the -session- value of 'auto_increment_increment' from the server if it exists, or '1' if not.
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  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()
           
 ExceptionInterceptor getExceptionInterceptor()
           
 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 static Connection getInstance(java.lang.String hostToConnectTo, int portToConnectTo, java.util.Properties info, java.lang.String databaseToConnectTo, java.lang.String url)
          Creates a connection instance -- We need to provide factory-style methods so we can support both JDBC3 (and older) and JDBC4 runtimes, otherwise the class verifier complains when it tries to load JDBC4-only interface classes that are present in JDBC4 method signatures.
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.
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
 java.util.Properties getProperties()
          Returns the parsed and passed in properties for this connection.
 boolean getRequiresEscapingEncoder()
           
 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()
           
 java.lang.String getStatementComment()
          Returns the comment that will be prepended to all statements sent to the server.
protected  java.util.List getStatementInterceptorsInstances()
           
 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)
          Does this connection have the same properties as another?
 boolean hasTriedMaster()
          Has this connection tried to execute a query on the "master" server (first host in a multiple host list).
protected  void incrementNumberOfPreparedExecutes()
           
protected  void incrementNumberOfPrepares()
           
protected  void incrementNumberOfResultSetsCreated()
           
 void initializeExtension(Extension ex)
           
protected  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.
protected  void initializeSafeStatementInterceptors()
           
 boolean isAbonormallyLongQuery(long millisOrNanos)
           
protected  boolean isClientTzUTC()
           
 boolean isClosed()
          DOCUMENT ME!
protected  boolean isCursorFetchEnabled()
           
 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 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)
          Does this connection have the same resource name as the given connection (for XA)?
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
protected  void pingInternal(boolean checkForClosedConnection, int timeoutMillis)
           
 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 reportQueryTime(long millisOrNanos)
           
 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)
           
 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.
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)
          Set the state of being in a global (XA) transaction.
 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
protected  void setReadOnlyInternal(boolean readOnlyFlag)
           
 java.sql.Savepoint setSavepoint()
           
 java.sql.Savepoint setSavepoint(java.lang.String name)
           
 void setStatementComment(java.lang.String comment)
          Sets the comment that will be prepended to all statements sent to the server.
 void setTransactionIsolation(int level)
          DOCUMENT ME!
 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 storesLowerCaseTableName()
           
 boolean supportsIsolationLevel()
          DOCUMENT ME!
 boolean supportsQuotedIdentifiers()
          DOCUMENT ME!
 boolean supportsTransactions()
          DOCUMENT ME!
(package private)  void throwConnectionClosedException()
           
protected  void transactionBegun()
           
protected  void transactionCompleted()
           
(package private)  void unregisterStatement(Statement stmt)
          Remove the given statement from the list of open statements
protected  void unSafeStatementInterceptors()
           
(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)
          Does the server this connection is connected to meet or exceed the given version?
 
Methods inherited from class com.mysql.jdbc.ConnectionPropertiesImpl
exposeAsDriverPropertyInfo, exposeAsDriverPropertyInfoInternal, exposeAsProperties, exposeAsXml, getAllowLoadLocalInfile, getAllowMultiQueries, getAllowNanAndInf, getAllowUrlInLocalInfile, getAlwaysSendSetIsolation, getAutoClosePStmtStreams, getAutoDeserialize, getAutoGenerateTestcaseScript, getAutoReconnectForPools, getAutoSlowLog, getBlobsAreStrings, getBlobSendChunkSize, getCacheCallableStatements, getCacheCallableStmts, getCachePreparedStatements, getCachePrepStmts, getCacheResultSetMetadata, getCacheServerConfiguration, getCallableStatementCacheSize, getCallableStmtCacheSize, getCapitalizeTypeNames, getCharacterSetResults, getClientCertificateKeyStorePassword, getClientCertificateKeyStoreType, getClientCertificateKeyStoreUrl, getClientInfoProvider, getClobberStreamingResults, getClobCharacterEncoding, getCompensateOnDuplicateKeyUpdateCounts, getConnectionCollation, getConnectionLifecycleInterceptors, getConnectTimeout, getContinueBatchOnError, getCreateDatabaseIfNotExist, getDefaultFetchSize, getDontTrackOpenResources, getDumpMetadataOnColumnNotFound, getDumpQueriesOnException, getDynamicCalendars, getElideSetAutoCommits, getEmptyStringsConvertToZero, getEmulateLocators, getEmulateUnsupportedPstmts, getEnablePacketDebug, getEnableQueryTimeouts, getEncoding, getExceptionInterceptors, getExplainSlowQueries, getFailOverReadOnly, getFunctionsNeverReturnBlobs, getGatherPerfMetrics, getGatherPerformanceMetrics, getGenerateSimpleParameterMetadata, getHighAvailability, getHoldResultsOpenOverStatementClose, getIgnoreNonTxTables, getIncludeInnodbStatusInDeadlockExceptions, getInitialTimeout, getInteractiveClient, getIsInteractiveClient, getJdbcCompliantTruncation, getJdbcCompliantTruncationForReads, getLargeRowSizeThreshold, getLoadBalanceBlacklistTimeout, getLoadBalanceStrategy, getLocalSocketAddress, getLocatorFetchBufferSize, getLogger, getLoggerClassName, getLogSlowQueries, getLogXaCommands, getMaintainTimeStats, getMaxAllowedPacket, getMaxQuerySizeToLog, getMaxReconnects, getMaxRows, getMetadataCacheSize, getNetTimeoutForStreamingResults, getNoAccessToProcedureBodies, getNoDatetimeStringSync, getNoTimezoneConversionForTimeType, getNullCatalogMeansCurrent, getNullNamePatternMatchesAll, getOverrideSupportsIntegrityEnhancementFacility, getPacketDebugBufferSize, getPadCharsWithSpace, getParanoid, getPasswordCharacterEncoding, getPedantic, getPinGlobalTxToPhysicalConnection, getPopulateInsertRowWithDefaultValues, getPreparedStatementCacheSize, getPreparedStatementCacheSqlLimit, getPrepStmtCacheSize, getPrepStmtCacheSqlLimit, getProcessEscapeCodesForPrepStmts, getProfilerEventHandler, getProfileSql, getProfileSQL, getPropertiesTransform, getQueriesBeforeRetryMaster, getQueryTimeoutKillsConnection, getReconnectAtTxEnd, getRelaxAutoCommit, getReportMetricsIntervalMillis, getRequireSSL, getResourceId, getResultSetSizeThreshold, getRetainStatementAfterResultSetClose, getRetriesAllDown, getRewriteBatchedStatements, getRollbackOnPooledClose, getRoundRobinLoadBalance, getRunningCTS13, getSecondsBeforeRetryMaster, getSelfDestructOnPingMaxOperations, getSelfDestructOnPingSecondsLifetime, getServerTimezone, getSessionVariables, getSlowQueryThresholdMillis, getSlowQueryThresholdNanos, getSocketFactory, getSocketFactoryClassName, getSocketTimeout, getStatementInterceptors, getStrictFloatingPoint, getStrictUpdates, getTcpKeepAlive, getTcpNoDelay, getTcpRcvBuf, getTcpSndBuf, getTcpTrafficClass, getTinyInt1isBit, getTraceProtocol, getTransformedBitIsBoolean, getTreatUtilDateAsTimestamp, getTrustCertificateKeyStorePassword, getTrustCertificateKeyStoreType, getTrustCertificateKeyStoreUrl, getUltraDevHack, getUseAffectedRows, getUseBlobToStoreUTF8OutsideBMP, getUseColumnNamesInFindColumn, getUseCompression, getUseConfigs, getUseCursorFetch, getUseDirectRowUnpack, getUseDynamicCharsetInfo, getUseFastDateParsing, getUseFastIntParsing, getUseGmtMillisForDatetimes, getUseHostsInPrivileges, getUseInformationSchema, getUseJDBCCompliantTimezoneShift, getUseJvmCharsetConverters, getUseLegacyDatetimeCode, getUseLocalSessionState, getUseLocalTransactionState, getUseNanosForElapsedTime, getUseOldAliasMetadataBehavior, getUseOldUTF8Behavior, getUseOnlyServerErrorMessages, getUseReadAheadInput, getUseServerPreparedStmts, getUseServerPrepStmts, getUseSqlStateCodes, getUseSSL, getUseSSPSCompatibleTimezoneShift, getUseStreamLengthsInPrepStmts, getUseTimezone, getUseUltraDevWorkAround, getUseUnbufferedInput, getUseUnicode, getUseUsageAdvisor, getUtf8OutsideBmpExcludedColumnNamePattern, getUtf8OutsideBmpIncludedColumnNamePattern, getVerifyServerCertificate, getYearIsDateType, getZeroDateTimeBehavior, initializeFromRef, initializeProperties, postInitialization, setAllowLoadLocalInfile, setAllowMultiQueries, setAllowNanAndInf, setAllowUrlInLocalInfile, setAlwaysSendSetIsolation, setAutoClosePStmtStreams, setAutoDeserialize, setAutoGenerateTestcaseScript, setAutoReconnect, setAutoReconnectForConnectionPools, setAutoReconnectForPools, setAutoSlowLog, setBlobsAreStrings, setBlobSendChunkSize, setCacheCallableStatements, setCacheCallableStmts, setCachePreparedStatements, setCachePrepStmts, setCacheResultSetMetadata, setCacheServerConfiguration, setCallableStatementCacheSize, setCallableStmtCacheSize, setCapitalizeDBMDTypes, setCapitalizeTypeNames, setCharacterEncoding, setCharacterSetResults, setClientCertificateKeyStorePassword, setClientCertificateKeyStoreType, setClientCertificateKeyStoreUrl, setClientInfoProvider, setClobberStreamingResults, setClobCharacterEncoding, setCompensateOnDuplicateKeyUpdateCounts, setConnectionCollation, setConnectionLifecycleInterceptors, setConnectTimeout, setContinueBatchOnError, setCreateDatabaseIfNotExist, setDefaultFetchSize, setDetectServerPreparedStmts, setDontTrackOpenResources, setDumpMetadataOnColumnNotFound, setDumpQueriesOnException, setDynamicCalendars, setElideSetAutoCommits, setEmptyStringsConvertToZero, setEmulateLocators, setEmulateUnsupportedPstmts, setEnablePacketDebug, setEnableQueryTimeouts, setEncoding, setExceptionInterceptors, setExplainSlowQueries, setFailOverReadOnly, setFunctionsNeverReturnBlobs, setGatherPerfMetrics, setGatherPerformanceMetrics, setGenerateSimpleParameterMetadata, setHighAvailability, setHoldResultsOpenOverStatementClose, setIgnoreNonTxTables, setIncludeInnodbStatusInDeadlockExceptions, setInitialTimeout, setInteractiveClient, setIsInteractiveClient, setJdbcCompliantTruncation, setJdbcCompliantTruncationForReads, setLargeRowSizeThreshold, setLoadBalanceBlacklistTimeout, setLoadBalanceStrategy, setLocalSocketAddress, setLocatorFetchBufferSize, setLogger, setLoggerClassName, setLogSlowQueries, setLogXaCommands, setMaintainTimeStats, setMaxAllowedPacket, setMaxQuerySizeToLog, setMaxReconnects, setMaxRows, setMetadataCacheSize, setNetTimeoutForStreamingResults, setNoAccessToProcedureBodies, setNoDatetimeStringSync, setNoTimezoneConversionForTimeType, setNullCatalogMeansCurrent, setNullNamePatternMatchesAll, setOverrideSupportsIntegrityEnhancementFacility, setPacketDebugBufferSize, setPadCharsWithSpace, setParanoid, setPasswordCharacterEncoding, setPedantic, setPinGlobalTxToPhysicalConnection, setPopulateInsertRowWithDefaultValues, setPreparedStatementCacheSize, setPreparedStatementCacheSqlLimit, setPrepStmtCacheSize, setPrepStmtCacheSqlLimit, setProcessEscapeCodesForPrepStmts, setProfilerEventHandler, setProfileSql, setProfileSQL, setPropertiesTransform, setQueriesBeforeRetryMaster, setQueryTimeoutKillsConnection, setReconnectAtTxEnd, setRelaxAutoCommit, setReportMetricsIntervalMillis, setRequireSSL, setResourceId, setResultSetSizeThreshold, setRetainStatementAfterResultSetClose, setRetriesAllDown, setRewriteBatchedStatements, setRollbackOnPooledClose, setRoundRobinLoadBalance, setRunningCTS13, setSecondsBeforeRetryMaster, setSelfDestructOnPingMaxOperations, setSelfDestructOnPingSecondsLifetime, setServerTimezone, setSessionVariables, setSlowQueryThresholdMillis, setSlowQueryThresholdNanos, setSocketFactory, setSocketFactoryClassName, setSocketTimeout, setStatementInterceptors, setStrictFloatingPoint, setStrictUpdates, setTcpKeepAlive, setTcpNoDelay, setTcpRcvBuf, setTcpSndBuf, setTcpTrafficClass, setTinyInt1isBit, setTraceProtocol, setTransformedBitIsBoolean, setTreatUtilDateAsTimestamp, setTrustCertificateKeyStorePassword, setTrustCertificateKeyStoreType, setTrustCertificateKeyStoreUrl, setUltraDevHack, setUseAffectedRows, setUseBlobToStoreUTF8OutsideBMP, setUseColumnNamesInFindColumn, setUseCompression, setUseConfigs, setUseCursorFetch, setUseDirectRowUnpack, setUseDynamicCharsetInfo, setUseFastDateParsing, setUseFastIntParsing, setUseGmtMillisForDatetimes, setUseHostsInPrivileges, setUseInformationSchema, setUseJDBCCompliantTimezoneShift, setUseJvmCharsetConverters, setUseLegacyDatetimeCode, setUseLocalSessionState, setUseLocalTransactionState, setUseNanosForElapsedTime, setUseOldAliasMetadataBehavior, setUseOldUTF8Behavior, setUseOnlyServerErrorMessages, setUseReadAheadInput, setUseServerPreparedStmts, setUseServerPrepStmts, setUseSqlStateCodes, setUseSSL, setUseSSPSCompatibleTimezoneShift, setUseStreamLengthsInPrepStmts, setUseTimezone, setUseUltraDevWorkAround, setUseUnbufferedInput, setUseUnicode, setUseUsageAdvisor, setUtf8OutsideBmpExcludedColumnNamePattern, setUtf8OutsideBmpIncludedColumnNamePattern, setVerifyServerCertificate, setYearIsDateType, setZeroDateTimeBehavior, storeToRef, useUnbufferedInput
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.sql.Connection
createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStruct, getClientInfo, getClientInfo, isValid, setClientInfo, setClientInfo
 
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
 
Methods inherited from interface com.mysql.jdbc.ConnectionProperties
exposeAsXml, getAllowLoadLocalInfile, getAllowMultiQueries, getAllowNanAndInf, getAllowUrlInLocalInfile, getAlwaysSendSetIsolation, getAutoClosePStmtStreams, getAutoDeserialize, getAutoGenerateTestcaseScript, getAutoReconnectForPools, getAutoSlowLog, getBlobsAreStrings, getBlobSendChunkSize, getCacheCallableStatements, getCacheCallableStmts, getCachePreparedStatements, getCachePrepStmts, getCacheResultSetMetadata, getCacheServerConfiguration, getCallableStatementCacheSize, getCallableStmtCacheSize, getCapitalizeTypeNames, getCharacterSetResults, getClientCertificateKeyStorePassword, getClientCertificateKeyStoreType, getClientCertificateKeyStoreUrl, getClientInfoProvider, getClobberStreamingResults, getClobCharacterEncoding, getCompensateOnDuplicateKeyUpdateCounts, getConnectionCollation, getConnectionLifecycleInterceptors, getConnectTimeout, getContinueBatchOnError, getCreateDatabaseIfNotExist, getDefaultFetchSize, getDontTrackOpenResources, getDumpMetadataOnColumnNotFound, getDumpQueriesOnException, getDynamicCalendars, getElideSetAutoCommits, getEmptyStringsConvertToZero, getEmulateLocators, getEmulateUnsupportedPstmts, getEnablePacketDebug, getEnableQueryTimeouts, getEncoding, getExceptionInterceptors, getExplainSlowQueries, getFailOverReadOnly, getFunctionsNeverReturnBlobs, getGatherPerfMetrics, getGatherPerformanceMetrics, getGenerateSimpleParameterMetadata, getHoldResultsOpenOverStatementClose, getIgnoreNonTxTables, getIncludeInnodbStatusInDeadlockExceptions, getInitialTimeout, getInteractiveClient, getIsInteractiveClient, getJdbcCompliantTruncation, getJdbcCompliantTruncationForReads, getLargeRowSizeThreshold, getLoadBalanceBlacklistTimeout, getLoadBalanceStrategy, getLocalSocketAddress, getLocatorFetchBufferSize, getLogger, getLoggerClassName, getLogSlowQueries, getLogXaCommands, getMaintainTimeStats, getMaxQuerySizeToLog, getMaxReconnects, getMaxRows, getMetadataCacheSize, getNetTimeoutForStreamingResults, getNoAccessToProcedureBodies, getNoDatetimeStringSync, getNoTimezoneConversionForTimeType, getNullCatalogMeansCurrent, getNullNamePatternMatchesAll, getOverrideSupportsIntegrityEnhancementFacility, getPacketDebugBufferSize, getPadCharsWithSpace, getParanoid, getPasswordCharacterEncoding, getPedantic, getPinGlobalTxToPhysicalConnection, getPopulateInsertRowWithDefaultValues, getPreparedStatementCacheSize, getPreparedStatementCacheSqlLimit, getPrepStmtCacheSize, getPrepStmtCacheSqlLimit, getProcessEscapeCodesForPrepStmts, getProfilerEventHandler, getProfileSql, getProfileSQL, getPropertiesTransform, getQueriesBeforeRetryMaster, getQueryTimeoutKillsConnection, getReconnectAtTxEnd, getRelaxAutoCommit, getReportMetricsIntervalMillis, getRequireSSL, getResourceId, getResultSetSizeThreshold, getRetriesAllDown, getRewriteBatchedStatements, getRollbackOnPooledClose, getRoundRobinLoadBalance, getRunningCTS13, getSecondsBeforeRetryMaster, getSelfDestructOnPingMaxOperations, getSelfDestructOnPingSecondsLifetime, getServerTimezone, getSessionVariables, getSlowQueryThresholdMillis, getSlowQueryThresholdNanos, getSocketFactory, getSocketFactoryClassName, getSocketTimeout, getStatementInterceptors, getStrictFloatingPoint, getStrictUpdates, getTcpKeepAlive, getTcpNoDelay, getTcpRcvBuf, getTcpSndBuf, getTcpTrafficClass, getTinyInt1isBit, getTraceProtocol, getTransformedBitIsBoolean, getTreatUtilDateAsTimestamp, getTrustCertificateKeyStorePassword, getTrustCertificateKeyStoreType, getTrustCertificateKeyStoreUrl, getUltraDevHack, getUseAffectedRows, getUseBlobToStoreUTF8OutsideBMP, getUseColumnNamesInFindColumn, getUseCompression, getUseConfigs, getUseCursorFetch, getUseDirectRowUnpack, getUseDynamicCharsetInfo, getUseFastDateParsing, getUseFastIntParsing, getUseGmtMillisForDatetimes, getUseHostsInPrivileges, getUseInformationSchema, getUseJDBCCompliantTimezoneShift, getUseJvmCharsetConverters, getUseLegacyDatetimeCode, getUseLocalSessionState, getUseLocalTransactionState, getUseNanosForElapsedTime, getUseOldAliasMetadataBehavior, getUseOldUTF8Behavior, getUseOnlyServerErrorMessages, getUseReadAheadInput, getUseServerPreparedStmts, getUseServerPrepStmts, getUseSqlStateCodes, getUseSSL, getUseSSPSCompatibleTimezoneShift, getUseStreamLengthsInPrepStmts, getUseTimezone, getUseUltraDevWorkAround, getUseUnbufferedInput, getUseUnicode, getUseUsageAdvisor, getUtf8OutsideBmpExcludedColumnNamePattern, getUtf8OutsideBmpIncludedColumnNamePattern, getVerifyServerCertificate, getYearIsDateType, getZeroDateTimeBehavior, setAllowLoadLocalInfile, setAllowMultiQueries, setAllowNanAndInf, setAllowUrlInLocalInfile, setAlwaysSendSetIsolation, setAutoClosePStmtStreams, setAutoDeserialize, setAutoGenerateTestcaseScript, setAutoReconnect, setAutoReconnectForConnectionPools, setAutoReconnectForPools, setAutoSlowLog, setBlobsAreStrings, setBlobSendChunkSize, setCacheCallableStatements, setCacheCallableStmts, setCachePreparedStatements, setCachePrepStmts, setCacheResultSetMetadata, setCacheServerConfiguration, setCallableStatementCacheSize, setCallableStmtCacheSize, setCapitalizeDBMDTypes, setCapitalizeTypeNames, setCharacterEncoding, setCharacterSetResults, setClientCertificateKeyStorePassword, setClientCertificateKeyStoreType, setClientCertificateKeyStoreUrl, setClientInfoProvider, setClobberStreamingResults, setClobCharacterEncoding, setCompensateOnDuplicateKeyUpdateCounts, setConnectionCollation, setConnectionLifecycleInterceptors, setConnectTimeout, setContinueBatchOnError, setCreateDatabaseIfNotExist, setDefaultFetchSize, setDetectServerPreparedStmts, setDontTrackOpenResources, setDumpMetadataOnColumnNotFound, setDumpQueriesOnException, setDynamicCalendars, setElideSetAutoCommits, setEmptyStringsConvertToZero, setEmulateLocators, setEmulateUnsupportedPstmts, setEnablePacketDebug, setEnableQueryTimeouts, setEncoding, setExceptionInterceptors, setExplainSlowQueries, setFailOverReadOnly, setFunctionsNeverReturnBlobs, setGatherPerfMetrics, setGatherPerformanceMetrics, setGenerateSimpleParameterMetadata, setHoldResultsOpenOverStatementClose, setIgnoreNonTxTables, setIncludeInnodbStatusInDeadlockExceptions, setInitialTimeout, setInteractiveClient, setIsInteractiveClient, setJdbcCompliantTruncation, setJdbcCompliantTruncationForReads, setLargeRowSizeThreshold, setLoadBalanceBlacklistTimeout, setLoadBalanceStrategy, setLocalSocketAddress, setLocatorFetchBufferSize, setLogger, setLoggerClassName, setLogSlowQueries, setLogXaCommands, setMaintainTimeStats, setMaxQuerySizeToLog, setMaxReconnects, setMaxRows, setMetadataCacheSize, setNetTimeoutForStreamingResults, setNoAccessToProcedureBodies, setNoDatetimeStringSync, setNoTimezoneConversionForTimeType, setNullCatalogMeansCurrent, setNullNamePatternMatchesAll, setOverrideSupportsIntegrityEnhancementFacility, setPacketDebugBufferSize, setPadCharsWithSpace, setParanoid, setPasswordCharacterEncoding, setPedantic, setPinGlobalTxToPhysicalConnection, setPopulateInsertRowWithDefaultValues, setPreparedStatementCacheSize, setPreparedStatementCacheSqlLimit, setPrepStmtCacheSize, setPrepStmtCacheSqlLimit, setProcessEscapeCodesForPrepStmts, setProfilerEventHandler, setProfileSql, setProfileSQL, setPropertiesTransform, setQueriesBeforeRetryMaster, setQueryTimeoutKillsConnection, setReconnectAtTxEnd, setRelaxAutoCommit, setReportMetricsIntervalMillis, setRequireSSL, setResourceId, setResultSetSizeThreshold, setRetainStatementAfterResultSetClose, setRetriesAllDown, setRewriteBatchedStatements, setRollbackOnPooledClose, setRoundRobinLoadBalance, setRunningCTS13, setSecondsBeforeRetryMaster, setSelfDestructOnPingMaxOperations, setSelfDestructOnPingSecondsLifetime, setServerTimezone, setSessionVariables, setSlowQueryThresholdMillis, setSlowQueryThresholdNanos, setSocketFactory, setSocketFactoryClassName, setSocketTimeout, setStatementInterceptors, setStrictFloatingPoint, setStrictUpdates, setTcpKeepAlive, setTcpNoDelay, setTcpRcvBuf, setTcpSndBuf, setTcpTrafficClass, setTinyInt1isBit, setTraceProtocol, setTransformedBitIsBoolean, setTreatUtilDateAsTimestamp, setTrustCertificateKeyStorePassword, setTrustCertificateKeyStoreType, setTrustCertificateKeyStoreUrl, setUltraDevHack, setUseAffectedRows, setUseBlobToStoreUTF8OutsideBMP, setUseColumnNamesInFindColumn, setUseCompression, setUseConfigs, setUseCursorFetch, setUseDirectRowUnpack, setUseDynamicCharsetInfo, setUseFastDateParsing, setUseFastIntParsing, setUseGmtMillisForDatetimes, setUseHostsInPrivileges, setUseInformationSchema, setUseJDBCCompliantTimezoneShift, setUseJvmCharsetConverters, setUseLegacyDatetimeCode, setUseLocalSessionState, setUseLocalTransactionState, setUseNanosForElapsedTime, setUseOldAliasMetadataBehavior, setUseOldUTF8Behavior, setUseOnlyServerErrorMessages, setUseReadAheadInput, setUseServerPreparedStmts, setUseServerPrepStmts, setUseSqlStateCodes, setUseSSL, setUseSSPSCompatibleTimezoneShift, setUseStreamLengthsInPrepStmts, setUseTimezone, setUseUltraDevWorkAround, setUseUnbufferedInput, setUseUnicode, setUseUsageAdvisor, setUtf8OutsideBmpExcludedColumnNamePattern, setUtf8OutsideBmpIncludedColumnNamePattern, setVerifyServerCertificate, setYearIsDateType, setZeroDateTimeBehavior, useUnbufferedInput
 

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

props

protected java.util.Properties props
Properties for this connection specified by user


resultSetMetadataCache

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

Constructor Detail

ConnectionImpl

protected ConnectionImpl()
' For the delegate only


ConnectionImpl

protected ConnectionImpl(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
d - the Driver instantation 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,
                                                                ExceptionInterceptor interceptor)

getCancelTimer

protected java.util.Timer getCancelTimer()

getInstance

protected static Connection getInstance(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 instance -- We need to provide factory-style methods so we can support both JDBC3 (and older) and JDBC4 runtimes, otherwise the class verifier complains when it tries to load JDBC4-only interface classes that are present in JDBC4 method signatures.

Throws:
java.sql.SQLException

unSafeStatementInterceptors

protected void unSafeStatementInterceptors()
                                    throws java.sql.SQLException
Throws:
java.sql.SQLException

initializeSafeStatementInterceptors

protected void initializeSafeStatementInterceptors()
                                            throws java.sql.SQLException
Throws:
java.sql.SQLException

getStatementInterceptorsInstances

protected java.util.List getStatementInterceptorsInstances()

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.

checkClosed

protected void checkClosed()
                    throws java.sql.SQLException
Throws:
java.sql.SQLException

throwConnectionClosedException

void throwConnectionClosedException()
                              throws java.sql.SQLException
Throws:
java.sql.SQLException

abortInternal

protected void abortInternal()
                      throws java.sql.SQLException
Clobbers the physical network connection and marks this connection as closed.

Throws:
java.sql.SQLException

clearHasTriedMaster

public void clearHasTriedMaster()

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 java.sql.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!
See Also:
Connection.prepareStatement(String)

clientPrepareStatement

public java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql,
                                                         int autoGenKeyIndex)
                                                  throws java.sql.SQLException
Description copied from interface: Connection
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.

Throws:
java.sql.SQLException
See Also:
Connection.prepareStatement(String, int)

clientPrepareStatement

public java.sql.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!
See Also:
Connection.prepareStatement(String, int, int)

clientPrepareStatement

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

clientPrepareStatement

public java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql,
                                                         int[] autoGenKeyIndexes)
                                                  throws java.sql.SQLException
Description copied from interface: Connection
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.

Throws:
java.sql.SQLException
See Also:
Connection.prepareStatement(String, int[])

clientPrepareStatement

public java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql,
                                                         java.lang.String[] autoGenKeyColNames)
                                                  throws java.sql.SQLException
Description copied from interface: Connection
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.

Throws:
java.sql.SQLException
See Also:
Connection.prepareStatement(String, String[])

clientPrepareStatement

public java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql,
                                                         int resultSetType,
                                                         int resultSetConcurrency,
                                                         int resultSetHoldability)
                                                  throws java.sql.SQLException
Description copied from interface: Connection
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.

Throws:
java.sql.SQLException
See Also:
Connection.prepareStatement(String, int, int, int)

close

public void close()
           throws java.sql.SQLException
In some cases, it is desirable to immediately release a Connection's database and JDBC resources instead of waiting for them to be automatically released (cant think why off the top of my head) Note: A Connection is automatically closed when it is garbage collected. Certain fatal errors also result in a closed connection.

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

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 void createNewIO(boolean isForReconnect)
                    throws java.sql.SQLException
Creates an IO channel to the server

Parameters:
isForReconnect - is this request for a re-connect
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:
Connection.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

ResultSetInternalMethods execSQL(StatementImpl callingStatement,
                                 java.lang.String sql,
                                 int maxRows,
                                 Buffer packet,
                                 int resultSetType,
                                 int resultSetConcurrency,
                                 boolean streamResults,
                                 java.lang.String catalog,
                                 Field[] cachedMetadata)
                           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!
queryIsSelectOnly - DOCUMENT ME!
catalog - DOCUMENT ME!
unpackFields - DOCUMENT ME!
Returns:
a ResultSet holding the results
Throws:
java.sql.SQLException - if a database error occurs

execSQL

ResultSetInternalMethods execSQL(StatementImpl callingStatement,
                                 java.lang.String sql,
                                 int maxRows,
                                 Buffer packet,
                                 int resultSetType,
                                 int resultSetConcurrency,
                                 boolean streamResults,
                                 java.lang.String catalog,
                                 Field[] cachedMetadata,
                                 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!

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable - DOCUMENT ME!

generateConnectionCommentBlock

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

getActiveStatementCount

public int getActiveStatementCount()
Description copied from interface: Connection
Returns the number of statements active on this connection, which haven't been .close()d.


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.

getErrorMessageEncoding

protected java.lang.String getErrorMessageEncoding()

getHoldability

public int getHoldability()
                   throws java.sql.SQLException
Specified by:
getHoldability in interface java.sql.Connection
Throws:
java.sql.SQLException
See Also:
Connection.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

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

public 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)
Description copied from interface: Connection
Does this connection have the same properties as another?


getProperties

public java.util.Properties getProperties()
Description copied from interface: Connection
Returns the parsed and passed in properties for this connection.

Returns:

hasTriedMaster

public boolean hasTriedMaster()
Description copied from interface: Connection
Has this connection tried to execute a query on the "master" server (first host in a multiple host list).


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()
Description copied from interface: Connection
Is this connection currently a participant in an XA transaction?


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)
Description copied from interface: Connection
Does this connection have the same resource name as the given connection (for XA)?

Returns:

isServerTzUTC

protected boolean isServerTzUTC()

getAutoIncrementIncrement

public int getAutoIncrementIncrement()
Description copied from interface: Connection
Returns the -session- value of 'auto_increment_increment' from the server if it exists, or '1' if not.


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

pingInternal

protected void pingInternal(boolean checkForClosedConnection,
                            int timeoutMillis)
                     throws java.sql.SQLException
Throws:
java.sql.SQLException

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:
Connection.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:
Connection.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:
Connection.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:
Connection.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:
Connection.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)
                                 throws java.sql.SQLException
Throws:
java.sql.SQLException

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:
Connection.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:
Connection.rollback(Savepoint)

serverPrepareStatement

public java.sql.PreparedStatement serverPrepareStatement(java.lang.String sql)
                                                  throws java.sql.SQLException
Description copied from interface: Connection
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.

Throws:
java.sql.SQLException
See Also:
Connection.prepareStatement(String)

serverPrepareStatement

public java.sql.PreparedStatement serverPrepareStatement(java.lang.String sql,
                                                         int autoGenKeyIndex)
                                                  throws java.sql.SQLException
Description copied from interface: Connection
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.

Throws:
java.sql.SQLException
See Also:
Connection.prepareStatement(String, int)

serverPrepareStatement

public java.sql.PreparedStatement serverPrepareStatement(java.lang.String sql,
                                                         int resultSetType,
                                                         int resultSetConcurrency)
                                                  throws java.sql.SQLException
Description copied from interface: Connection
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.

Throws:
java.sql.SQLException
See Also:
Connection.prepareStatement(String, int, int)

serverPrepareStatement

public java.sql.PreparedStatement serverPrepareStatement(java.lang.String sql,
                                                         int resultSetType,
                                                         int resultSetConcurrency,
                                                         int resultSetHoldability)
                                                  throws java.sql.SQLException
Description copied from interface: Connection
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.

Throws:
java.sql.SQLException
See Also:
Connection.prepareStatement(String, int, int, int)

serverPrepareStatement

public java.sql.PreparedStatement serverPrepareStatement(java.lang.String sql,
                                                         int[] autoGenKeyIndexes)
                                                  throws java.sql.SQLException
Description copied from interface: Connection
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.

Throws:
java.sql.SQLException
See Also:
Connection.prepareStatement(String, int[])

serverPrepareStatement

public java.sql.PreparedStatement serverPrepareStatement(java.lang.String sql,
                                                         java.lang.String[] autoGenKeyColNames)
                                                  throws java.sql.SQLException
Description copied from interface: Connection
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.

Throws:
java.sql.SQLException
See Also:
Connection.prepareStatement(String, String[])

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)
Parameters:
failedOver - The failedOver to set.

setHoldability

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

setInGlobalTx

public void setInGlobalTx(boolean flag)
Description copied from interface: Connection
Set the state of being in a global (XA) transaction.


setPreferSlaveDuringFailover

public void setPreferSlaveDuringFailover(boolean flag)
Parameters:
preferSlaveDuringFailover - The preferSlaveDuringFailover to set.

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

setReadOnlyInternal

protected void setReadOnlyInternal(boolean readOnlyFlag)
                            throws java.sql.SQLException
Throws:
java.sql.SQLException

setSavepoint

public java.sql.Savepoint setSavepoint()
                                throws java.sql.SQLException
Specified by:
setSavepoint in interface java.sql.Connection
Throws:
java.sql.SQLException
See Also:
Connection.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:
Connection.setSavepoint(String)

setTransactionIsolation

public void setTransactionIsolation(int level)
                             throws java.sql.SQLException
DOCUMENT ME!

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

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
Description copied from interface: Connection
Does the server this connection is connected to meet or exceed the given version?

Throws:
java.sql.SQLException

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,
                                                  ResultSetInternalMethods 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

getStatementComment

public java.lang.String getStatementComment()
Returns the comment that will be prepended to all statements sent to the server.

Returns:
the comment that will be prepended to all statements sent to the server.

setStatementComment

public void setStatementComment(java.lang.String comment)
Sets the comment that will be prepended to all statements sent to the server. Do not use slash-star or star-slash tokens in the comment as these will be added by the driver itself.

Parameters:
comment - the comment that will be prepended to all statements sent to the server.

reportQueryTime

public void reportQueryTime(long millisOrNanos)

isAbonormallyLongQuery

public boolean isAbonormallyLongQuery(long millisOrNanos)

initializeExtension

public void initializeExtension(Extension ex)
                         throws java.sql.SQLException
Throws:
java.sql.SQLException

transactionBegun

protected void transactionBegun()
                         throws java.sql.SQLException
Throws:
java.sql.SQLException

transactionCompleted

protected void transactionCompleted()
                             throws java.sql.SQLException
Throws:
java.sql.SQLException

storesLowerCaseTableName

public boolean storesLowerCaseTableName()

getExceptionInterceptor

public ExceptionInterceptor getExceptionInterceptor()
Specified by:
getExceptionInterceptor in interface ConnectionProperties
Overrides:
getExceptionInterceptor in class ConnectionPropertiesImpl

getRequiresEscapingEncoder

public boolean getRequiresEscapingEncoder()