com.mysql.jdbc
Class ConnectionImpl

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

public class ConnectionImpl
extends ConnectionPropertiesImpl
implements MySQLConnection

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) static 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, ConnectionPropertiesImpl.XmlMap
 
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
 java.util.Map<java.lang.Integer,java.lang.String> indexToCustomMysqlCharset
           
 java.util.Map<java.lang.Integer,java.lang.String> indexToJavaCharset
          We need this 'bootstrapped', because 4.1 and newer will send fields back with this even before we fill this dynamically from the server.
protected  java.util.Properties props
          Properties for this connection specified by user
protected  com.mysql.jdbc.util.LRUCache resultSetMetadataCache
          Cache of ResultSet metadata
protected static java.util.Map<?,?> roundRobinStatsMap
           
 
Fields inherited from class com.mysql.jdbc.ConnectionPropertiesImpl
characterEncodingIsAliasForSjis, 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
 void abort(java.util.concurrent.Executor executor)
          Terminates an open connection.
 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.
 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!
 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.
 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)
           
 void dumpTestcaseQuery(java.lang.String query)
           
 Connection duplicate()
           
 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.
 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)
           
 java.lang.String extractSqlFromPacket(java.lang.String possibleSqlQuery, Buffer queryPacket, int endOfQueryPacketPosition)
           
 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.
 CachedResultSetMetaData getCachedMetaData(java.lang.String sql)
          Returns cached metadata (or null if not cached) for the given query, which must match _exactly_.
 java.util.Calendar getCalendarInstanceForSessionOrNew()
          Optimization to only use one calendar per-session, or calculate it for each call, depending on user configuration
 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.
 java.lang.String getCharacterSetMetadata()
           
 SingleByteCharsetConverter getCharsetConverter(java.lang.String javaEncodingName)
          Returns the locally mapped instance of a charset converter (to avoid overhead of static synchronization).
 java.lang.String getCharsetNameForIndex(int charsetIndex)
          Returns the Java character encoding name for the given MySQL server charset index
 java.lang.Object getConnectionMutex()
           
 java.util.TimeZone getDefaultTimeZone()
          DOCUMENT ME!
 java.lang.String getErrorMessageEncoding()
           
 ExceptionInterceptor getExceptionInterceptor()
           
 int getHoldability()
           
 java.lang.String getHost()
           
 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.
 MysqlIO getIO()
          Returns the IO channel to the server
 java.lang.String getJavaEncodingForMysqlEncoding(java.lang.String mysqlEncoding)
           
 MySQLConnection getLoadBalanceSafeProxy()
           
 com.mysql.jdbc.log.Log getLog()
          Returns the log mechanism that should be used to log information from/for this Connection.
 int getMaxBytesPerChar(java.lang.Integer charsetIndex, java.lang.String javaCharsetName)
           
 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.
 java.sql.Statement getMetadataSafeStatement()
           
 int getNetBufferLength()
          Returns the packet buffer size the MySQL server reported upon connection
 int getNetworkTimeout()
           
protected static int getNextRoundRobinHostIndex(java.lang.String url, java.util.List<?> hostList)
           
 java.util.Properties getProperties()
          Returns the parsed and passed in properties for this connection.
 boolean getRequiresEscapingEncoder()
           
 java.lang.String getSchema()
           
 java.lang.String getServerCharacterEncoding()
          Returns the server's character set
 int getServerMajorVersion()
           
 int getServerMinorVersion()
           
 int getServerSubMinorVersion()
           
 java.util.TimeZone getServerTimezoneTZ()
          DOCUMENT ME!
 java.lang.String getServerVariable(java.lang.String variableName)
           
 java.lang.String getServerVersion()
           
 java.util.Calendar getSessionLockedCalendar()
           
 java.lang.String getStatementComment()
          Returns the comment that will be prepended to all statements sent to the server.
 java.util.List<StatementInterceptorV2> getStatementInterceptorsInstances()
           
 int getTransactionIsolation()
          Get this Connection's current transaction isolation mode.
 java.util.Map<java.lang.String,java.lang.Class<?>> getTypeMap()
          JDBC 2.0 Get the type-map object associated with this connection.
 java.lang.String getURL()
           
 java.lang.String getUser()
           
 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).
 void incrementNumberOfPreparedExecutes()
           
 void incrementNumberOfPrepares()
           
 void incrementNumberOfResultSetsCreated()
           
 void initializeExtension(Extension ex)
           
 void initializeResultsMetadataFromCache(java.lang.String sql, CachedResultSetMetaData cachedMetaData, ResultSetInternalMethods resultSet)
          Caches CachedResultSetMetaData that has been placed in the cache using the given SQL as a key.
 void initializeSafeStatementInterceptors()
           
 boolean isAbonormallyLongQuery(long millisOrNanos)
           
 boolean isClientTzUTC()
           
 boolean isClosed()
          DOCUMENT ME!
 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?
 boolean isProxySet()
           
 boolean isReadInfoMsgEnabled()
           
 boolean isReadOnly()
          Tests to see if the connection is in Read Only Mode.
 boolean isReadOnly(boolean useSessionStatus)
          Tests to see if the connection is in Read Only Mode.
 boolean isRunningOnJDK13()
           
 boolean isSameResource(Connection otherConnection)
          Does this connection have the same resource name as the given connection (for XA)?
 boolean isServerLocal()
          Is the server this connection is connected to "local" (i.e. same host) as the application?
 boolean isServerTzUTC()
           
 boolean lowerCaseTableNames()
          Is the server configured to use lower-case table names only?
 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
 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)
           
 void realClose(boolean calledExplicitly, boolean issueRollback, boolean skipLocalTeardown, java.lang.Throwable reason)
          Closes connection and frees resources.
 void recachePreparedStatement(ServerPreparedStatement pstmt)
           
 void registerQueryExecutionTime(long queryTimeMs)
          DOCUMENT ME!
 void registerStatement(Statement stmt)
          Register a Statement instance as open.
 void releaseSavepoint(java.sql.Savepoint arg0)
           
protected  void reportMetricsIfNeeded()
          Reports currently collected metrics if this feature is enabled and the timeout has passed.
 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.
 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 setNetworkTimeout(java.util.concurrent.Executor executor, int milliseconds)
           
 void setPreferSlaveDuringFailover(boolean flag)
           
 void setProxy(MySQLConnection proxy)
           
 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
 void setReadOnlyInternal(boolean readOnlyFlag)
           
 void setRealProxy(java.lang.reflect.InvocationHandler proxy)
           
 java.sql.Savepoint setSavepoint()
           
 java.sql.Savepoint setSavepoint(java.lang.String name)
           
 void setSchema(java.lang.String schema)
           
 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<java.lang.String,java.lang.Class<?>> 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!
 void throwConnectionClosedException()
           
 void transactionBegun()
           
 void transactionCompleted()
           
 void unregisterStatement(Statement stmt)
          Remove the given statement from the list of open statements
 void unSafeStatementInterceptors()
           
 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.
 boolean useAnsiQuotedIdentifiers()
           
 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, getAuthenticationPlugins, 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, getDefaultAuthenticationPlugin, getDefaultFetchSize, getDisabledAuthenticationPlugins, getDisconnectOnExpiredPasswords, getDontTrackOpenResources, getDumpMetadataOnColumnNotFound, getDumpQueriesOnException, getDynamicCalendars, getElideSetAutoCommits, getEmptyStringsConvertToZero, getEmulateLocators, getEmulateUnsupportedPstmts, getEnablePacketDebug, getEnableQueryTimeouts, getEncoding, getExceptionInterceptors, getExplainSlowQueries, getFailOverReadOnly, getFunctionsNeverReturnBlobs, getGatherPerfMetrics, getGatherPerformanceMetrics, getGenerateSimpleParameterMetadata, getHighAvailability, getHoldResultsOpenOverStatementClose, getIgnoreNonTxTables, getIncludeInnodbStatusInDeadlockExceptions, getIncludeThreadDumpInDeadlockExceptions, getIncludeThreadNamesAsStatementComment, getInitialTimeout, getInteractiveClient, getIsInteractiveClient, getJdbcCompliantTruncation, getJdbcCompliantTruncationForReads, getLargeRowSizeThreshold, getLoadBalanceAutoCommitStatementRegex, getLoadBalanceAutoCommitStatementThreshold, getLoadBalanceBlacklistTimeout, getLoadBalanceConnectionGroup, getLoadBalanceEnableJMX, getLoadBalanceExceptionChecker, getLoadBalancePingTimeout, getLoadBalanceSQLExceptionSubclassFailover, getLoadBalanceSQLStateFailover, getLoadBalanceStrategy, getLoadBalanceValidateConnectionOnSwapServer, getLocalSocketAddress, getLocatorFetchBufferSize, getLogger, getLoggerClassName, getLogSlowQueries, getLogXaCommands, getMaintainTimeStats, getMaxAllowedPacket, getMaxQuerySizeToLog, getMaxReconnects, getMaxRows, getMetadataCacheSize, getNetTimeoutForStreamingResults, getNoAccessToProcedureBodies, getNoDatetimeStringSync, getNoTimezoneConversionForTimeType, getNullCatalogMeansCurrent, getNullNamePatternMatchesAll, getOverrideSupportsIntegrityEnhancementFacility, getPacketDebugBufferSize, getPadCharsWithSpace, getParanoid, getParseInfoCacheFactory, 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, getServerConfigCacheFactory, 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, setAuthenticationPlugins, 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, setDefaultAuthenticationPlugin, setDefaultFetchSize, setDetectServerPreparedStmts, setDisabledAuthenticationPlugins, setDisconnectOnExpiredPasswords, setDontTrackOpenResources, setDumpMetadataOnColumnNotFound, setDumpQueriesOnException, setDynamicCalendars, setElideSetAutoCommits, setEmptyStringsConvertToZero, setEmulateLocators, setEmulateUnsupportedPstmts, setEnablePacketDebug, setEnableQueryTimeouts, setEncoding, setExceptionInterceptors, setExplainSlowQueries, setFailOverReadOnly, setFunctionsNeverReturnBlobs, setGatherPerfMetrics, setGatherPerformanceMetrics, setGenerateSimpleParameterMetadata, setHighAvailability, setHoldResultsOpenOverStatementClose, setIgnoreNonTxTables, setIncludeInnodbStatusInDeadlockExceptions, setIncludeThreadDumpInDeadlockExceptions, setIncludeThreadNamesAsStatementComment, setInitialTimeout, setInteractiveClient, setIsInteractiveClient, setJdbcCompliantTruncation, setJdbcCompliantTruncationForReads, setLargeRowSizeThreshold, setLoadBalanceAutoCommitStatementRegex, setLoadBalanceAutoCommitStatementThreshold, setLoadBalanceBlacklistTimeout, setLoadBalanceConnectionGroup, setLoadBalanceEnableJMX, setLoadBalanceExceptionChecker, setLoadBalancePingTimeout, setLoadBalanceSQLExceptionSubclassFailover, setLoadBalanceSQLStateFailover, setLoadBalanceStrategy, setLoadBalanceValidateConnectionOnSwapServer, setLocalSocketAddress, setLocatorFetchBufferSize, setLogger, setLoggerClassName, setLogSlowQueries, setLogXaCommands, setMaintainTimeStats, setMaxAllowedPacket, setMaxQuerySizeToLog, setMaxReconnects, setMaxRows, setMetadataCacheSize, setNetTimeoutForStreamingResults, setNoAccessToProcedureBodies, setNoDatetimeStringSync, setNoTimezoneConversionForTimeType, setNullCatalogMeansCurrent, setNullNamePatternMatchesAll, setOverrideSupportsIntegrityEnhancementFacility, setPacketDebugBufferSize, setPadCharsWithSpace, setParanoid, setParseInfoCacheFactory, 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, setServerConfigCacheFactory, 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, finalize, 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, getAuthenticationPlugins, 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, getDefaultAuthenticationPlugin, getDefaultFetchSize, getDisabledAuthenticationPlugins, getDisconnectOnExpiredPasswords, getDontTrackOpenResources, getDumpMetadataOnColumnNotFound, getDumpQueriesOnException, getDynamicCalendars, getElideSetAutoCommits, getEmptyStringsConvertToZero, getEmulateLocators, getEmulateUnsupportedPstmts, getEnablePacketDebug, getEnableQueryTimeouts, getEncoding, getExceptionInterceptors, getExplainSlowQueries, getFailOverReadOnly, getFunctionsNeverReturnBlobs, getGatherPerfMetrics, getGatherPerformanceMetrics, getGenerateSimpleParameterMetadata, getHoldResultsOpenOverStatementClose, getIgnoreNonTxTables, getIncludeInnodbStatusInDeadlockExceptions, getIncludeThreadDumpInDeadlockExceptions, getIncludeThreadNamesAsStatementComment, getInitialTimeout, getInteractiveClient, getIsInteractiveClient, getJdbcCompliantTruncation, getJdbcCompliantTruncationForReads, getLargeRowSizeThreshold, getLoadBalanceAutoCommitStatementRegex, getLoadBalanceAutoCommitStatementThreshold, getLoadBalanceBlacklistTimeout, getLoadBalanceConnectionGroup, getLoadBalanceEnableJMX, getLoadBalanceExceptionChecker, getLoadBalancePingTimeout, getLoadBalanceSQLExceptionSubclassFailover, getLoadBalanceSQLStateFailover, getLoadBalanceStrategy, getLoadBalanceValidateConnectionOnSwapServer, getLocalSocketAddress, getLocatorFetchBufferSize, getLogger, getLoggerClassName, getLogSlowQueries, getLogXaCommands, getMaintainTimeStats, getMaxAllowedPacket, getMaxQuerySizeToLog, getMaxReconnects, getMaxRows, getMetadataCacheSize, getNetTimeoutForStreamingResults, getNoAccessToProcedureBodies, getNoDatetimeStringSync, getNoTimezoneConversionForTimeType, getNullCatalogMeansCurrent, getNullNamePatternMatchesAll, getOverrideSupportsIntegrityEnhancementFacility, getPacketDebugBufferSize, getPadCharsWithSpace, getParanoid, getParseInfoCacheFactory, 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, getServerConfigCacheFactory, 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, setAuthenticationPlugins, 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, setDefaultAuthenticationPlugin, setDefaultFetchSize, setDetectServerPreparedStmts, setDisabledAuthenticationPlugins, setDisconnectOnExpiredPasswords, setDontTrackOpenResources, setDumpMetadataOnColumnNotFound, setDumpQueriesOnException, setDynamicCalendars, setElideSetAutoCommits, setEmptyStringsConvertToZero, setEmulateLocators, setEmulateUnsupportedPstmts, setEnablePacketDebug, setEnableQueryTimeouts, setEncoding, setExceptionInterceptors, setExplainSlowQueries, setFailOverReadOnly, setFunctionsNeverReturnBlobs, setGatherPerfMetrics, setGatherPerformanceMetrics, setGenerateSimpleParameterMetadata, setHoldResultsOpenOverStatementClose, setIgnoreNonTxTables, setIncludeInnodbStatusInDeadlockExceptions, setIncludeThreadDumpInDeadlockExceptions, setIncludeThreadNamesAsStatementComment, setInitialTimeout, setInteractiveClient, setIsInteractiveClient, setJdbcCompliantTruncation, setJdbcCompliantTruncationForReads, setLargeRowSizeThreshold, setLoadBalanceAutoCommitStatementRegex, setLoadBalanceAutoCommitStatementThreshold, setLoadBalanceBlacklistTimeout, setLoadBalanceConnectionGroup, setLoadBalanceEnableJMX, setLoadBalanceExceptionChecker, setLoadBalancePingTimeout, setLoadBalanceSQLExceptionSubclassFailover, setLoadBalanceSQLStateFailover, setLoadBalanceStrategy, setLoadBalanceValidateConnectionOnSwapServer, setLocalSocketAddress, setLocatorFetchBufferSize, setLogger, setLoggerClassName, setLogSlowQueries, setLogXaCommands, setMaintainTimeStats, setMaxQuerySizeToLog, setMaxReconnects, setMaxRows, setMetadataCacheSize, setNetTimeoutForStreamingResults, setNoAccessToProcedureBodies, setNoDatetimeStringSync, setNoTimezoneConversionForTimeType, setNullCatalogMeansCurrent, setNullNamePatternMatchesAll, setOverrideSupportsIntegrityEnhancementFacility, setPacketDebugBufferSize, setPadCharsWithSpace, setParanoid, setParseInfoCacheFactory, 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, setServerConfigCacheFactory, 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

roundRobinStatsMap

protected static java.util.Map<?,?> roundRobinStatsMap

indexToJavaCharset

public java.util.Map<java.lang.Integer,java.lang.String> indexToJavaCharset
We need this 'bootstrapped', because 4.1 and newer will send fields back with this even before we fill this dynamically from the server.


indexToCustomMysqlCharset

public java.util.Map<java.lang.Integer,java.lang.String> indexToCustomMysqlCharset

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

getHost

public java.lang.String getHost()
Specified by:
getHost in interface MySQLConnection

isProxySet

public boolean isProxySet()
Specified by:
isProxySet in interface MySQLConnection

setProxy

public void setProxy(MySQLConnection proxy)
Specified by:
setProxy in interface MySQLConnection

setRealProxy

public void setRealProxy(java.lang.reflect.InvocationHandler proxy)

getLoadBalanceSafeProxy

public MySQLConnection getLoadBalanceSafeProxy()
Specified by:
getLoadBalanceSafeProxy in interface MySQLConnection

getConnectionMutex

public java.lang.Object getConnectionMutex()

appendMessageToException

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

getCancelTimer

public java.util.Timer getCancelTimer()
Specified by:
getCancelTimer in interface MySQLConnection

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

getNextRoundRobinHostIndex

protected static int getNextRoundRobinHostIndex(java.lang.String url,
                                                java.util.List<?> hostList)
Parameters:
url -
hostList -
Returns:

unSafeStatementInterceptors

public void unSafeStatementInterceptors()
                                 throws java.sql.SQLException
Specified by:
unSafeStatementInterceptors in interface MySQLConnection
Throws:
java.sql.SQLException

initializeSafeStatementInterceptors

public void initializeSafeStatementInterceptors()
                                         throws java.sql.SQLException
Specified by:
initializeSafeStatementInterceptors in interface MySQLConnection
Throws:
java.sql.SQLException

getStatementInterceptorsInstances

public java.util.List<StatementInterceptorV2> getStatementInterceptorsInstances()
Specified by:
getStatementInterceptorsInstances in interface MySQLConnection

getJavaEncodingForMysqlEncoding

public java.lang.String getJavaEncodingForMysqlEncoding(java.lang.String mysqlEncoding)
                                                 throws java.sql.SQLException
Throws:
java.sql.SQLException

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

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

throwConnectionClosedException

public void throwConnectionClosedException()
                                    throws java.sql.SQLException
Specified by:
throwConnectionClosedException in interface MySQLConnection
Throws:
java.sql.SQLException

abortInternal

public 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

public 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

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

Specified by:
createNewIO in interface MySQLConnection
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

public void dumpTestcaseQuery(java.lang.String query)
Specified by:
dumpTestcaseQuery in interface MySQLConnection

duplicate

public Connection duplicate()
                     throws java.sql.SQLException
Specified by:
duplicate in interface MySQLConnection
Throws:
java.sql.SQLException

execSQL

public 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.

Specified by:
execSQL in interface MySQLConnection
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

public 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
Specified by:
execSQL in interface MySQLConnection
Throws:
java.sql.SQLException

extractSqlFromPacket

public java.lang.String extractSqlFromPacket(java.lang.String possibleSqlQuery,
                                             Buffer queryPacket,
                                             int endOfQueryPacketPosition)
                                      throws java.sql.SQLException
Specified by:
extractSqlFromPacket in interface MySQLConnection
Throws:
java.sql.SQLException

generateConnectionCommentBlock

public java.lang.StringBuffer generateConnectionCommentBlock(java.lang.StringBuffer buf)
Specified by:
generateConnectionCommentBlock in interface MySQLConnection

getActiveStatementCount

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

Specified by:
getActiveStatementCount in interface MySQLConnection

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

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

Specified by:
getCalendarInstanceForSessionOrNew in interface MySQLConnection

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

public java.lang.String getCharacterSetMetadata()
Specified by:
getCharacterSetMetadata in interface MySQLConnection
Returns:
Returns the characterSetMetadata.

getCharsetConverter

public 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).

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

getCharsetNameForIndex

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

Specified by:
getCharsetNameForIndex in interface MySQLConnection
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

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

Specified by:
getDefaultTimeZone in interface MySQLConnection
Returns:
Returns the defaultTimeZone.

getErrorMessageEncoding

public java.lang.String getErrorMessageEncoding()
Specified by:
getErrorMessageEncoding in interface MySQLConnection

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

public long getId()
Specified by:
getId in interface MySQLConnection

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.

Specified by:
getIdleFor in interface MySQLConnection
Returns:
number of ms that this connection has been idle, 0 if the driver is busy retrieving results.

getIO

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

Specified by:
getIO in interface MySQLConnection
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.

Specified by:
getLog in interface MySQLConnection
Returns:
the Log instance to use for logging messages.
Throws:
java.sql.SQLException - if an error occurs

getMaxBytesPerChar

public int getMaxBytesPerChar(java.lang.String javaCharsetName)
                       throws java.sql.SQLException
Specified by:
getMaxBytesPerChar in interface MySQLConnection
Throws:
java.sql.SQLException

getMaxBytesPerChar

public int getMaxBytesPerChar(java.lang.Integer charsetIndex,
                              java.lang.String javaCharsetName)
                       throws java.sql.SQLException
Specified by:
getMaxBytesPerChar in interface MySQLConnection
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

public java.sql.Statement getMetadataSafeStatement()
                                            throws java.sql.SQLException
Specified by:
getMetadataSafeStatement in interface MySQLConnection
Throws:
java.sql.SQLException

getNetBufferLength

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

Specified by:
getNetBufferLength in interface MySQLConnection
Returns:
DOCUMENT ME!

getServerCharacterEncoding

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

Specified by:
getServerCharacterEncoding in interface MySQLConnection
Returns:
the server's character set.

getServerMajorVersion

public int getServerMajorVersion()
Specified by:
getServerMajorVersion in interface MySQLConnection

getServerMinorVersion

public int getServerMinorVersion()
Specified by:
getServerMinorVersion in interface MySQLConnection

getServerSubMinorVersion

public int getServerSubMinorVersion()
Specified by:
getServerSubMinorVersion in interface MySQLConnection

getServerTimezoneTZ

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

Specified by:
getServerTimezoneTZ in interface MySQLConnection
Returns:
DOCUMENT ME!

getServerVariable

public java.lang.String getServerVariable(java.lang.String variableName)
Specified by:
getServerVariable in interface MySQLConnection

getServerVersion

public java.lang.String getServerVersion()
Specified by:
getServerVersion in interface MySQLConnection

getSessionLockedCalendar

public java.util.Calendar getSessionLockedCalendar()
Specified by:
getSessionLockedCalendar in interface MySQLConnection

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<java.lang.String,java.lang.Class<?>> 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

public java.lang.String getURL()
Specified by:
getURL in interface MySQLConnection

getUser

public java.lang.String getUser()
Specified by:
getUser in interface MySQLConnection

getUtcCalendar

public java.util.Calendar getUtcCalendar()
Specified by:
getUtcCalendar in interface MySQLConnection

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.

Specified by:
getProperties in interface MySQLConnection
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

public void incrementNumberOfPreparedExecutes()
Specified by:
incrementNumberOfPreparedExecutes in interface MySQLConnection

incrementNumberOfPrepares

public void incrementNumberOfPrepares()
Specified by:
incrementNumberOfPrepares in interface MySQLConnection

incrementNumberOfResultSetsCreated

public void incrementNumberOfResultSetsCreated()
Specified by:
incrementNumberOfResultSetsCreated in interface MySQLConnection

isClientTzUTC

public boolean isClientTzUTC()
Specified by:
isClientTzUTC in interface MySQLConnection

isClosed

public boolean isClosed()
DOCUMENT ME!

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

isCursorFetchEnabled

public boolean isCursorFetchEnabled()
                             throws java.sql.SQLException
Specified by:
isCursorFetchEnabled in interface MySQLConnection
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

public boolean isReadInfoMsgEnabled()
Specified by:
isReadInfoMsgEnabled in interface MySQLConnection

isReadOnly

public boolean isReadOnly()
                   throws java.sql.SQLException
Tests to see if the connection is in Read Only Mode. Note that prior to 5.6, 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 MySQLConnection
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

isReadOnly

public boolean isReadOnly(boolean useSessionStatus)
                   throws java.sql.SQLException
Tests to see if the connection is in Read Only Mode. Note that prior to 5.6, 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 MySQLConnection
Parameters:
useSessionStatus - in some cases, for example when restoring connection with autoReconnect=true, we can rely only on saved readOnly state, so use useSessionStatus=false in that case
Returns:
true if the connection is read only
Throws:
java.sql.SQLException - if a database access error occurs

isRunningOnJDK13

public boolean isRunningOnJDK13()
Specified by:
isRunningOnJDK13 in interface MySQLConnection

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

public boolean isServerTzUTC()
Specified by:
isServerTzUTC in interface MySQLConnection

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.

Specified by:
getAutoIncrementIncrement in interface MySQLConnection

lowerCaseTableNames

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

Specified by:
lowerCaseTableNames in interface MySQLConnection
Returns:
true if lower_case_table_names is 'on'

maxRowsChanged

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

Specified by:
maxRowsChanged in interface MySQLConnection
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

public void pingInternal(boolean checkForClosedConnection,
                         int timeoutMillis)
                  throws java.sql.SQLException
Specified by:
pingInternal in interface MySQLConnection
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

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

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

recachePreparedStatement

public void recachePreparedStatement(ServerPreparedStatement pstmt)
                              throws java.sql.SQLException
Specified by:
recachePreparedStatement in interface MySQLConnection
Throws:
java.sql.SQLException

registerQueryExecutionTime

public void registerQueryExecutionTime(long queryTimeMs)
DOCUMENT ME!

Specified by:
registerQueryExecutionTime in interface MySQLConnection
Parameters:
queryTimeMs -

registerStatement

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

Specified by:
registerStatement in interface MySQLConnection
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)

reportMetricsIfNeeded

protected void reportMetricsIfNeeded()
Reports currently collected metrics if this feature is enabled and the timeout has passed.


reportNumberOfTablesAccessed

public void reportNumberOfTablesAccessed(int numTablesAccessed)
Specified by:
reportNumberOfTablesAccessed in interface MySQLConnection

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

public boolean serverSupportsConvertFn()
                                throws java.sql.SQLException
Specified by:
serverSupportsConvertFn in interface MySQLConnection
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

public void setReadInfoMsgEnabled(boolean flag)
Specified by:
setReadInfoMsgEnabled in interface MySQLConnection

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

public void setReadOnlyInternal(boolean readOnlyFlag)
                         throws java.sql.SQLException
Specified by:
setReadOnlyInternal in interface MySQLConnection
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<java.lang.String,java.lang.Class<?>> 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

Specified by:
shutdownServer in interface MySQLConnection
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

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

Specified by:
unregisterStatement in interface MySQLConnection
Parameters:
stmt - the Statement instance to remove

unsetMaxRows

public 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.

Specified by:
unsetMaxRows in interface MySQLConnection
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

public boolean useAnsiQuotedIdentifiers()
Specified by:
useAnsiQuotedIdentifiers in interface MySQLConnection

useMaxRows

public boolean useMaxRows()
Has maxRows() been set?

Specified by:
useMaxRows in interface MySQLConnection
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

public 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.

Specified by:
getCachedMetaData in interface MySQLConnection
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

public 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.

Specified by:
initializeResultsMetadataFromCache in interface MySQLConnection
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.

Specified by:
getStatementComment in interface MySQLConnection
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)
Specified by:
isAbonormallyLongQuery in interface MySQLConnection

initializeExtension

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

transactionBegun

public void transactionBegun()
                      throws java.sql.SQLException
Specified by:
transactionBegun in interface MySQLConnection
Throws:
java.sql.SQLException

transactionCompleted

public void transactionCompleted()
                          throws java.sql.SQLException
Specified by:
transactionCompleted in interface MySQLConnection
Throws:
java.sql.SQLException

storesLowerCaseTableName

public boolean storesLowerCaseTableName()
Specified by:
storesLowerCaseTableName in interface MySQLConnection

getExceptionInterceptor

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

getRequiresEscapingEncoder

public boolean getRequiresEscapingEncoder()
Specified by:
getRequiresEscapingEncoder in interface MySQLConnection

isServerLocal

public boolean isServerLocal()
                      throws java.sql.SQLException
Description copied from interface: Connection
Is the server this connection is connected to "local" (i.e. same host) as the application?

Returns:
Throws:
java.sql.SQLException

setSchema

public void setSchema(java.lang.String schema)
               throws java.sql.SQLException
Throws:
java.sql.SQLException

getSchema

public java.lang.String getSchema()
                           throws java.sql.SQLException
Throws:
java.sql.SQLException

abort

public void abort(java.util.concurrent.Executor executor)
           throws java.sql.SQLException
Terminates an open connection. Calling abort results in:

Calling abort marks the connection closed and releases any resources. Calling abort on a closed connection is a no-op.

It is possible that the aborting and releasing of the resources that are held by the connection can take an extended period of time. When the abort method returns, the connection will have been marked as closed and the Executor that was passed as a parameter to abort may still be executing tasks to release resources.

This method checks to see that there is an SQLPermission object before allowing the method to proceed. If a SecurityManager exists and its checkPermission method denies calling abort, this method throws a java.lang.SecurityException.

Parameters:
executor - The Executor implementation which will be used by abort.
Throws:
java.sql.SQLException - if a database access error occurs or the executor is null,
java.lang.SecurityException - if a security manager exists and its checkPermission method denies calling abort
Since:
1.7
See Also:
SecurityManager.checkPermission(java.security.Permission), Executor

setNetworkTimeout

public void setNetworkTimeout(java.util.concurrent.Executor executor,
                              int milliseconds)
                       throws java.sql.SQLException
Throws:
java.sql.SQLException

getNetworkTimeout

public int getNetworkTimeout()
                      throws java.sql.SQLException
Throws:
java.sql.SQLException