Class ConnectionImpl
- All Implemented Interfaces:
Connection, ConnectionProperties, MySQLConnection, Serializable, AutoCloseable, Connection, Wrapper
- Direct Known Subclasses:
JDBC4Connection
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classUsed 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.classNested classes/interfaces inherited from class ConnectionPropertiesImpl
ConnectionPropertiesImpl.BooleanConnectionProperty, ConnectionPropertiesImpl.ConnectionProperty, ConnectionPropertiesImpl.IntegerConnectionProperty, ConnectionPropertiesImpl.LongConnectionProperty, ConnectionPropertiesImpl.MemorySizeConnectionProperty, ConnectionPropertiesImpl.StringConnectionProperty, ConnectionPropertiesImpl.XmlMap -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic Map<?, ?> The mapping between MySQL charset names and Java charset names.protected static final StringDefault logger class namestatic final Stringprotected PropertiesProperties for this connection specified by userprotected com.mysql.jdbc.util.LRUCache<String, CachedResultSetMetaData> Cache of ResultSet metadataprotected static Map<?, ?> Fields inherited from class ConnectionPropertiesImpl
characterEncodingIsAliasForSjis, largeRowSizeThreshold, traceProtocol, ZERO_DATETIME_BEHAVIOR_CONVERT_TO_NULL, ZERO_DATETIME_BEHAVIOR_EXCEPTION, ZERO_DATETIME_BEHAVIOR_ROUNDFields inherited from interface Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected' For the delegate onlyConnectionImpl(String hostToConnectTo, int portToConnectTo, Properties info, String databaseToConnectTo, String url) Creates a connection to a MySQL Server. -
Method Summary
Modifier and TypeMethodDescriptionvoidTerminates an open connection.voidClobbers the physical network connection and marks this connection as closed.protected static SQLExceptionappendMessageToException(SQLException sqlEx, String messageToAppend, ExceptionInterceptor interceptor) voidchangeUser(String userName, String newPassword) Changes the user on this connection by performing a re-authentication.voidvoidDeprecated.voidAfter this call, getWarnings returns null until a new warning is reported for this 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.clientPrepareStatement(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.clientPrepareStatement(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.clientPrepareStatement(String sql, int resultSetType, int resultSetConcurrency) Prepares a statement on the client, using client-side emulation (irregardless of the configuration property 'useServerPrepStmts') with the same semantics as the java.sql.Connection.prepareStatement() method with the same argument types.clientPrepareStatement(String sql, int resultSetType, int resultSetConcurrency, boolean processEscapeCodesIfNeeded) clientPrepareStatement(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.clientPrepareStatement(String sql, 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.voidclose()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.voidcommit()The method commit() makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by the Connection.voidcreateNewIO(boolean isForReconnect) Creates an IO channel to the serverSQL statements without parameters are normally executed using Statement objects.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.createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) voidvoiddumpTestcaseQuery(String query) execSQL(StatementImpl callingStatement, String sql, int maxRows, Buffer packet, int resultSetType, int resultSetConcurrency, boolean streamResults, String catalog, Field[] cachedMetadata) Send a query to the server.execSQL(StatementImpl callingStatement, String sql, int maxRows, Buffer packet, int resultSetType, int resultSetConcurrency, boolean streamResults, String catalog, Field[] cachedMetadata, boolean isBatch) extractSqlFromPacket(String possibleSqlQuery, Buffer queryPacket, int endOfQueryPacketPosition) intReturns the number of statements active on this connection, which haven't been .close()d.booleanGets the current auto-commit stateintReturns the -session- value of 'auto_increment_increment' from the server if it exists, or '1' if not.getCachedMetaData(String sql) Returns cached metadata (or null if not cached) for the given query, which must match _exactly_.Optimization to only use one calendar per-session, or calculate it for each call, depending on user configurationReturn the connections current catalog name, or null if no catalog name is set, or we dont support catalogs.getCharsetConverter(String javaEncodingName) Returns the locally mapped instance of a charset converter (to avoid overhead of static synchronization).getCharsetNameForIndex(int charsetIndex) Deprecated.getEncodingForIndex(int charsetIndex) Returns the Java character encoding name for the given MySQL server charset indexintgetHost()longgetId()longNOT JDBC-Compliant, but clients can use this method to determine how long this connection has been idle.protected static ConnectiongetInstance(String hostToConnectTo, int portToConnectTo, Properties info, String databaseToConnectTo, 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.getIO()Returns the IO channel to the serverDeprecated.replaced bygetMultiHostSafeProxy()com.mysql.jdbc.log.LoggetLog()Returns the log mechanism that should be used to log information from/for this Connection.intgetMaxBytesPerChar(Integer charsetIndex, String javaCharsetName) intgetMaxBytesPerChar(String javaCharsetName) 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.getMetadataSafeStatement(int maxRows) intReturns the packet buffer size the MySQL server reported upon connectionintprotected static intgetNextRoundRobinHostIndex(String url, List<?> hostList) com.mysql.jdbc.profiler.ProfilerEventHandlerReturns the parsed and passed in properties for this connection.booleanDeprecated.replaced bygetServerCharset()Returns the server's character setintintintReturns the TimeZone that represents the configured timezone for the server.getServerVariable(String variableName) intReturns the sql select limit max-rows for this session.Returns the comment that will be prepended to all statements sent to the server.intGet this Connection's current transaction isolation mode.JDBC 2.0 Get the type-map object associated with this connection.getURL()getUser()The first warning reported by calls on this Connection is returned.booleanDoes this connection have the same properties as another?booleanDeprecated.voidvoidvoidvoidvoidinitializeResultsMetadataFromCache(String sql, CachedResultSetMetaData cachedMetaData, ResultSetInternalMethods resultSet) Caches CachedResultSetMetaData that has been placed in the cache using the given SQL as a key.voidbooleanisAbonormallyLongQuery(long millisOrNanos) Update statistics that allows the driver to determine if a query is slow enough to be logged, and return the estimation result for millisOrNanos value.booleanbooleanisClosed()booleanbooleanIs this connection currently a participant in an XA transaction?booleanIs this connection connected to the first host in the list if there is a list of servers in the URL?booleanIs the server in a sql_mode that doesn't allow us to use \\ to escape things?booleanbooleanbooleanbooleanTests to see if the connection is in Read Only Mode.booleanisReadOnly(boolean useSessionStatus) Tests to see if the connection is in Read Only Mode.booleanbooleanisSameResource(Connection otherConnection) Does this connection have the same resource name as the given connection (for XA)?booleanIs the server this connection is connected to "local" (i.e. same host) as the application?booleanbooleanbooleanIs the server configured to use lower-case table names only?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.booleanDoes the server this connection is connected to support unicode?voidping()Detect if the connection is still goodvoidpingInternal(boolean checkForClosedConnection, int timeoutMillis) prepareCall(String sql) prepareCall(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.prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) prepareStatement(String sql) A SQL statement with or without IN parameters can be pre-compiled and stored in a PreparedStatement object.prepareStatement(String sql, int autoGenKeyIndex) prepareStatement(String sql, int[] autoGenKeyIndexes) prepareStatement(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.prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) prepareStatement(String sql, String[] autoGenKeyColNames) voidrealClose(boolean calledExplicitly, boolean issueRollback, boolean skipLocalTeardown, Throwable reason) Closes connection and frees resources.voidvoidregisterQueryExecutionTime(long queryTimeMs) voidregisterStatement(Statement stmt) Register a Statement instance as open.voidreleaseSavepoint(Savepoint arg0) protected voidReports currently collected metrics if this feature is enabled and the timeout has passed.voidreportNumberOfTablesAccessed(int numTablesAccessed) voidreportQueryTime(long millisOrNanos) voidResets the server-side state of this connection.voidrollback()The method rollback() drops all changes made since the previous commit/rollback and releases any database locks currently held by the Connection.voidPrepares 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.serverPrepareStatement(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.serverPrepareStatement(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.serverPrepareStatement(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.serverPrepareStatement(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.serverPrepareStatement(String sql, 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.booleanvoidsetAutoCommit(boolean autoCommitFlag) If a connection is in auto-commit mode, than all its SQL statements will be executed and committed as individual transactions.voidsetCatalog(String catalog) A sub-space of this Connection's database may be selected by setting a catalog name.voidsetFailedOver(boolean flag) voidsetHoldability(int arg0) voidsetInGlobalTx(boolean flag) Set the state of being in a global (XA) transaction.voidsetNetworkTimeout(Executor executor, int milliseconds) voidsetPreferSlaveDuringFailover(boolean flag) Deprecated.voidsetProfilerEventHandlerInstance(com.mysql.jdbc.profiler.ProfilerEventHandler h) voidsetProxy(MySQLConnection proxy) voidsetReadInfoMsgEnabled(boolean flag) voidsetReadOnly(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 transactionvoidsetReadOnlyInternal(boolean readOnlyFlag) setSavepoint(String name) voidvoidsetSessionMaxRows(int max) Sets the sql select limit max-rows for this session if different from current.voidsetStatementComment(String comment) Sets the comment that will be prepended to all statements sent to the server.voidsetTransactionIsolation(int level) voidsetTypeMap(Map<String, Class<?>> map) JDBC 2.0 Install a type-map object as the default type-map for this connectionvoidUsed by MiniAdmin to shutdown a MySQL serverbooleanbooleanDoes the server this connection is connected to support isolation levels?booleanDoes the server this connection is connected to support quoted identifiers?booleanDoes the server this connection is connected to support transactions?voidvoidvoidvoidunregisterStatement(Statement stmt) Remove the given statement from the list of open statementsvoidbooleanbooleanversionMeetsMinimum(int major, int minor, int subminor) Does the server this connection is connected to meet or exceed the given version?Methods inherited from class ConnectionPropertiesImpl
exposeAsDriverPropertyInfo, exposeAsDriverPropertyInfoInternal, exposeAsProperties, exposeAsProperties, exposeAsXml, getAllowLoadLocalInfile, getAllowMasterDownConnections, getAllowMultiQueries, getAllowNanAndInf, getAllowPublicKeyRetrieval, getAllowSlaveDownConnections, getAllowUrlInLocalInfile, getAlwaysSendSetIsolation, getAuthenticationPlugins, getAutoClosePStmtStreams, getAutoDeserialize, getAutoGenerateTestcaseScript, getAutoReconnectForPools, getAutoSlowLog, getBlobsAreStrings, getBlobSendChunkSize, getCacheCallableStatements, getCacheCallableStmts, getCacheDefaultTimezone, getCachePreparedStatements, getCachePrepStmts, getCacheResultSetMetadata, getCacheServerConfiguration, getCallableStatementCacheSize, getCallableStmtCacheSize, getCapitalizeTypeNames, getCharacterSetResults, getClientCertificateKeyStorePassword, getClientCertificateKeyStoreType, getClientCertificateKeyStoreUrl, getClientInfoProvider, getClobberStreamingResults, getClobCharacterEncoding, getCompensateOnDuplicateKeyUpdateCounts, getConnectionAttributes, getConnectionCollation, getConnectionLifecycleInterceptors, getConnectTimeout, getContinueBatchOnError, getCreateDatabaseIfNotExist, getDefaultAuthenticationPlugin, getDefaultFetchSize, getDetectCustomCollations, getDisabledAuthenticationPlugins, getDisconnectOnExpiredPasswords, getDontCheckOnDuplicateKeyUpdateInSQL, getDontTrackOpenResources, getDumpMetadataOnColumnNotFound, getDumpQueriesOnException, getDynamicCalendars, getElideSetAutoCommits, getEmptyStringsConvertToZero, getEmulateLocators, getEmulateUnsupportedPstmts, getEnabledSSLCipherSuites, getEnabledTLSProtocols, getEnableEscapeProcessing, getEnablePacketDebug, getEnableQueryTimeouts, getEncoding, getExceptionInterceptors, getExplainSlowQueries, getFailOverReadOnly, getFunctionsNeverReturnBlobs, getGatherPerfMetrics, getGatherPerformanceMetrics, getGenerateSimpleParameterMetadata, getGetProceduresReturnsFunctions, getHighAvailability, getHoldResultsOpenOverStatementClose, getIgnoreNonTxTables, getIncludeInnodbStatusInDeadlockExceptions, getIncludeThreadDumpInDeadlockExceptions, getIncludeThreadNamesAsStatementComment, getInitialTimeout, getInteractiveClient, getIsInteractiveClient, getJdbcCompliantTruncation, getJdbcCompliantTruncationForReads, getLargeRowSizeThreshold, getLoadBalanceAutoCommitStatementRegex, getLoadBalanceAutoCommitStatementThreshold, getLoadBalanceBlacklistTimeout, getLoadBalanceConnectionGroup, getLoadBalanceEnableJMX, getLoadBalanceExceptionChecker, getLoadBalanceHostRemovalGracePeriod, getLoadBalancePingTimeout, getLoadBalanceSQLExceptionSubclassFailover, getLoadBalanceSQLStateFailover, getLoadBalanceStrategy, getLoadBalanceValidateConnectionOnSwapServer, getLocalSocketAddress, getLocatorFetchBufferSize, getLogger, getLoggerClassName, getLogSlowQueries, getLogXaCommands, getMaintainTimeStats, getMaxAllowedPacket, getMaxQuerySizeToLog, getMaxReconnects, getMaxRows, getMetadataCacheSize, getNetTimeoutForStreamingResults, getNoAccessToProcedureBodies, getNoDatetimeStringSync, getNoTimezoneConversionForDateType, getNoTimezoneConversionForTimeType, getNullCatalogMeansCurrent, getNullNamePatternMatchesAll, getOverrideSupportsIntegrityEnhancementFacility, getPacketDebugBufferSize, getPadCharsWithSpace, getParanoid, getParseInfoCacheFactory, getPasswordCharacterEncoding, getPedantic, getPinGlobalTxToPhysicalConnection, getPopulateInsertRowWithDefaultValues, getPreparedStatementCacheSize, getPreparedStatementCacheSqlLimit, getPrepStmtCacheSize, getPrepStmtCacheSqlLimit, getProcessEscapeCodesForPrepStmts, getProfilerEventHandler, getProfileSql, getProfileSQL, getPropertiesTransform, getQueriesBeforeRetryMaster, getQueryTimeoutKillsConnection, getReadFromMasterWhenNoSlaves, getReadOnlyPropagatesToServer, getReconnectAtTxEnd, getRelaxAutoCommit, getReplicationConnectionGroup, getReplicationEnableJMX, getReportMetricsIntervalMillis, getRequireSSL, getResourceId, getResultSetSizeThreshold, getRetainStatementAfterResultSetClose, getRetriesAllDown, getRewriteBatchedStatements, getRollbackOnPooledClose, getRoundRobinLoadBalance, getRunningCTS13, getSecondsBeforeRetryMaster, getSelfDestructOnPingMaxOperations, getSelfDestructOnPingSecondsLifetime, getSendFractionalSeconds, getServerAffinityOrder, getServerConfigCacheFactory, getServerRSAPublicKeyFile, getServerTimezone, getSessionVariables, getSlowQueryThresholdMillis, getSlowQueryThresholdNanos, getSocketFactory, getSocketFactoryClassName, getSocketTimeout, getSocksProxyHost, getSocksProxyPort, 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, isUseSSLExplicit, postInitialization, setAllowLoadLocalInfile, setAllowMasterDownConnections, setAllowMultiQueries, setAllowNanAndInf, setAllowPublicKeyRetrieval, setAllowSlaveDownConnections, setAllowUrlInLocalInfile, setAlwaysSendSetIsolation, setAuthenticationPlugins, setAutoClosePStmtStreams, setAutoDeserialize, setAutoGenerateTestcaseScript, setAutoReconnect, setAutoReconnectForConnectionPools, setAutoReconnectForPools, setAutoSlowLog, setBlobsAreStrings, setBlobSendChunkSize, setCacheCallableStatements, setCacheCallableStmts, setCacheDefaultTimezone, setCachePreparedStatements, setCachePrepStmts, setCacheResultSetMetadata, setCacheServerConfiguration, setCallableStatementCacheSize, setCallableStmtCacheSize, setCapitalizeDBMDTypes, setCapitalizeTypeNames, setCharacterEncoding, setCharacterSetResults, setClientCertificateKeyStorePassword, setClientCertificateKeyStoreType, setClientCertificateKeyStoreUrl, setClientInfoProvider, setClobberStreamingResults, setClobCharacterEncoding, setCompensateOnDuplicateKeyUpdateCounts, setConnectionAttributes, setConnectionCollation, setConnectionLifecycleInterceptors, setConnectTimeout, setContinueBatchOnError, setCreateDatabaseIfNotExist, setDefaultAuthenticationPlugin, setDefaultFetchSize, setDetectCustomCollations, setDetectServerPreparedStmts, setDisabledAuthenticationPlugins, setDisconnectOnExpiredPasswords, setDontCheckOnDuplicateKeyUpdateInSQL, setDontTrackOpenResources, setDumpMetadataOnColumnNotFound, setDumpQueriesOnException, setDynamicCalendars, setElideSetAutoCommits, setEmptyStringsConvertToZero, setEmulateLocators, setEmulateUnsupportedPstmts, setEnabledSSLCipherSuites, setEnabledTLSProtocols, setEnableEscapeProcessing, setEnablePacketDebug, setEnableQueryTimeouts, setEncoding, setExceptionInterceptors, setExplainSlowQueries, setFailOverReadOnly, setFunctionsNeverReturnBlobs, setGatherPerfMetrics, setGatherPerformanceMetrics, setGenerateSimpleParameterMetadata, setGetProceduresReturnsFunctions, setHighAvailability, setHoldResultsOpenOverStatementClose, setIgnoreNonTxTables, setIncludeInnodbStatusInDeadlockExceptions, setIncludeThreadDumpInDeadlockExceptions, setIncludeThreadNamesAsStatementComment, setInitialTimeout, setInteractiveClient, setIsInteractiveClient, setJdbcCompliantTruncation, setJdbcCompliantTruncationForReads, setLargeRowSizeThreshold, setLoadBalanceAutoCommitStatementRegex, setLoadBalanceAutoCommitStatementThreshold, setLoadBalanceBlacklistTimeout, setLoadBalanceConnectionGroup, setLoadBalanceEnableJMX, setLoadBalanceExceptionChecker, setLoadBalanceHostRemovalGracePeriod, setLoadBalancePingTimeout, setLoadBalanceSQLExceptionSubclassFailover, setLoadBalanceSQLStateFailover, setLoadBalanceStrategy, setLoadBalanceValidateConnectionOnSwapServer, setLocalSocketAddress, setLocatorFetchBufferSize, setLogger, setLoggerClassName, setLogSlowQueries, setLogXaCommands, setMaintainTimeStats, setMaxAllowedPacket, setMaxQuerySizeToLog, setMaxReconnects, setMaxRows, setMetadataCacheSize, setNetTimeoutForStreamingResults, setNoAccessToProcedureBodies, setNoDatetimeStringSync, setNoTimezoneConversionForDateType, setNoTimezoneConversionForTimeType, setNullCatalogMeansCurrent, setNullNamePatternMatchesAll, setOverrideSupportsIntegrityEnhancementFacility, setPacketDebugBufferSize, setPadCharsWithSpace, setParanoid, setParseInfoCacheFactory, setPasswordCharacterEncoding, setPedantic, setPinGlobalTxToPhysicalConnection, setPopulateInsertRowWithDefaultValues, setPreparedStatementCacheSize, setPreparedStatementCacheSqlLimit, setPrepStmtCacheSize, setPrepStmtCacheSqlLimit, setProcessEscapeCodesForPrepStmts, setProfilerEventHandler, setProfileSql, setProfileSQL, setPropertiesTransform, setQueriesBeforeRetryMaster, setQueryTimeoutKillsConnection, setReadFromMasterWhenNoSlaves, setReadOnlyPropagatesToServer, setReconnectAtTxEnd, setRelaxAutoCommit, setReplicationConnectionGroup, setReplicationEnableJMX, setReportMetricsIntervalMillis, setRequireSSL, setResourceId, setResultSetSizeThreshold, setRetainStatementAfterResultSetClose, setRetriesAllDown, setRewriteBatchedStatements, setRollbackOnPooledClose, setRoundRobinLoadBalance, setRunningCTS13, setSecondsBeforeRetryMaster, setSelfDestructOnPingMaxOperations, setSelfDestructOnPingSecondsLifetime, setSendFractionalSeconds, setServerAffinityOrder, setServerConfigCacheFactory, setServerRSAPublicKeyFile, setServerTimezone, setSessionVariables, setSlowQueryThresholdMillis, setSlowQueryThresholdNanos, setSocketFactory, setSocketFactoryClassName, setSocketTimeout, setSocksProxyHost, setSocksProxyPort, 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, useUnbufferedInputMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Connection
beginRequest, createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStruct, endRequest, getClientInfo, getClientInfo, isValid, setClientInfo, setClientInfo, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValidMethods inherited from interface ConnectionProperties
exposeAsXml, getAllowLoadLocalInfile, getAllowMasterDownConnections, getAllowMultiQueries, getAllowNanAndInf, getAllowPublicKeyRetrieval, getAllowSlaveDownConnections, getAllowUrlInLocalInfile, getAlwaysSendSetIsolation, getAuthenticationPlugins, getAutoClosePStmtStreams, getAutoDeserialize, getAutoGenerateTestcaseScript, getAutoReconnectForPools, getAutoSlowLog, getBlobsAreStrings, getBlobSendChunkSize, getCacheCallableStatements, getCacheCallableStmts, getCacheDefaultTimezone, getCachePreparedStatements, getCachePrepStmts, getCacheResultSetMetadata, getCacheServerConfiguration, getCallableStatementCacheSize, getCallableStmtCacheSize, getCapitalizeTypeNames, getCharacterSetResults, getClientCertificateKeyStorePassword, getClientCertificateKeyStoreType, getClientCertificateKeyStoreUrl, getClientInfoProvider, getClobberStreamingResults, getClobCharacterEncoding, getCompensateOnDuplicateKeyUpdateCounts, getConnectionCollation, getConnectionLifecycleInterceptors, getConnectTimeout, getContinueBatchOnError, getCreateDatabaseIfNotExist, getDefaultAuthenticationPlugin, getDefaultFetchSize, getDetectCustomCollations, getDisabledAuthenticationPlugins, getDisconnectOnExpiredPasswords, getDontCheckOnDuplicateKeyUpdateInSQL, getDontTrackOpenResources, getDumpMetadataOnColumnNotFound, getDumpQueriesOnException, getDynamicCalendars, getElideSetAutoCommits, getEmptyStringsConvertToZero, getEmulateLocators, getEmulateUnsupportedPstmts, getEnabledSSLCipherSuites, getEnabledTLSProtocols, getEnableEscapeProcessing, getEnablePacketDebug, getEnableQueryTimeouts, getEncoding, getExceptionInterceptors, getExplainSlowQueries, getFailOverReadOnly, getFunctionsNeverReturnBlobs, getGatherPerfMetrics, getGatherPerformanceMetrics, getGenerateSimpleParameterMetadata, getGetProceduresReturnsFunctions, getHoldResultsOpenOverStatementClose, getIgnoreNonTxTables, getIncludeInnodbStatusInDeadlockExceptions, getIncludeThreadDumpInDeadlockExceptions, getIncludeThreadNamesAsStatementComment, getInitialTimeout, getInteractiveClient, getIsInteractiveClient, getJdbcCompliantTruncation, getJdbcCompliantTruncationForReads, getLargeRowSizeThreshold, getLoadBalanceAutoCommitStatementRegex, getLoadBalanceAutoCommitStatementThreshold, getLoadBalanceBlacklistTimeout, getLoadBalanceConnectionGroup, getLoadBalanceEnableJMX, getLoadBalanceExceptionChecker, getLoadBalanceHostRemovalGracePeriod, getLoadBalancePingTimeout, getLoadBalanceSQLExceptionSubclassFailover, getLoadBalanceSQLStateFailover, getLoadBalanceStrategy, getLoadBalanceValidateConnectionOnSwapServer, getLocalSocketAddress, getLocatorFetchBufferSize, getLogger, getLoggerClassName, getLogSlowQueries, getLogXaCommands, getMaintainTimeStats, getMaxAllowedPacket, getMaxQuerySizeToLog, getMaxReconnects, getMaxRows, getMetadataCacheSize, getNetTimeoutForStreamingResults, getNoAccessToProcedureBodies, getNoDatetimeStringSync, getNoTimezoneConversionForDateType, getNoTimezoneConversionForTimeType, getNullCatalogMeansCurrent, getNullNamePatternMatchesAll, getOverrideSupportsIntegrityEnhancementFacility, getPacketDebugBufferSize, getPadCharsWithSpace, getParanoid, getParseInfoCacheFactory, getPasswordCharacterEncoding, getPedantic, getPinGlobalTxToPhysicalConnection, getPopulateInsertRowWithDefaultValues, getPreparedStatementCacheSize, getPreparedStatementCacheSqlLimit, getPrepStmtCacheSize, getPrepStmtCacheSqlLimit, getProcessEscapeCodesForPrepStmts, getProfilerEventHandler, getProfileSql, getProfileSQL, getPropertiesTransform, getQueriesBeforeRetryMaster, getQueryTimeoutKillsConnection, getReadFromMasterWhenNoSlaves, getReadOnlyPropagatesToServer, getReconnectAtTxEnd, getRelaxAutoCommit, getReplicationEnableJMX, getReportMetricsIntervalMillis, getRequireSSL, getResourceId, getResultSetSizeThreshold, getRetainStatementAfterResultSetClose, getRetriesAllDown, getRewriteBatchedStatements, getRollbackOnPooledClose, getRoundRobinLoadBalance, getRunningCTS13, getSecondsBeforeRetryMaster, getSelfDestructOnPingMaxOperations, getSelfDestructOnPingSecondsLifetime, getSendFractionalSeconds, getServerAffinityOrder, getServerConfigCacheFactory, getServerRSAPublicKeyFile, getServerTimezone, getSessionVariables, getSlowQueryThresholdMillis, getSlowQueryThresholdNanos, getSocketFactory, getSocketFactoryClassName, getSocketTimeout, getSocksProxyHost, getSocksProxyPort, 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, isUseSSLExplicit, setAllowLoadLocalInfile, setAllowMasterDownConnections, setAllowMultiQueries, setAllowNanAndInf, setAllowPublicKeyRetrieval, setAllowSlaveDownConnections, setAllowUrlInLocalInfile, setAlwaysSendSetIsolation, setAuthenticationPlugins, setAutoClosePStmtStreams, setAutoDeserialize, setAutoGenerateTestcaseScript, setAutoReconnect, setAutoReconnectForConnectionPools, setAutoReconnectForPools, setAutoSlowLog, setBlobsAreStrings, setBlobSendChunkSize, setCacheCallableStatements, setCacheCallableStmts, setCacheDefaultTimezone, setCachePreparedStatements, setCachePrepStmts, setCacheResultSetMetadata, setCacheServerConfiguration, setCallableStatementCacheSize, setCallableStmtCacheSize, setCapitalizeDBMDTypes, setCapitalizeTypeNames, setCharacterEncoding, setCharacterSetResults, setClientCertificateKeyStorePassword, setClientCertificateKeyStoreType, setClientCertificateKeyStoreUrl, setClientInfoProvider, setClobberStreamingResults, setClobCharacterEncoding, setCompensateOnDuplicateKeyUpdateCounts, setConnectionCollation, setConnectionLifecycleInterceptors, setConnectTimeout, setContinueBatchOnError, setCreateDatabaseIfNotExist, setDefaultAuthenticationPlugin, setDefaultFetchSize, setDetectCustomCollations, setDetectServerPreparedStmts, setDisabledAuthenticationPlugins, setDisconnectOnExpiredPasswords, setDontCheckOnDuplicateKeyUpdateInSQL, setDontTrackOpenResources, setDumpMetadataOnColumnNotFound, setDumpQueriesOnException, setDynamicCalendars, setElideSetAutoCommits, setEmptyStringsConvertToZero, setEmulateLocators, setEmulateUnsupportedPstmts, setEnabledSSLCipherSuites, setEnabledTLSProtocols, setEnableEscapeProcessing, setEnablePacketDebug, setEnableQueryTimeouts, setEncoding, setExceptionInterceptors, setExplainSlowQueries, setFailOverReadOnly, setFunctionsNeverReturnBlobs, setGatherPerfMetrics, setGatherPerformanceMetrics, setGenerateSimpleParameterMetadata, setGetProceduresReturnsFunctions, setHoldResultsOpenOverStatementClose, setIgnoreNonTxTables, setIncludeInnodbStatusInDeadlockExceptions, setIncludeThreadDumpInDeadlockExceptions, setIncludeThreadNamesAsStatementComment, setInitialTimeout, setInteractiveClient, setIsInteractiveClient, setJdbcCompliantTruncation, setJdbcCompliantTruncationForReads, setLargeRowSizeThreshold, setLoadBalanceAutoCommitStatementRegex, setLoadBalanceAutoCommitStatementThreshold, setLoadBalanceBlacklistTimeout, setLoadBalanceConnectionGroup, setLoadBalanceEnableJMX, setLoadBalanceExceptionChecker, setLoadBalanceHostRemovalGracePeriod, setLoadBalancePingTimeout, setLoadBalanceSQLExceptionSubclassFailover, setLoadBalanceSQLStateFailover, setLoadBalanceStrategy, setLoadBalanceValidateConnectionOnSwapServer, setLocalSocketAddress, setLocatorFetchBufferSize, setLogger, setLoggerClassName, setLogSlowQueries, setLogXaCommands, setMaintainTimeStats, setMaxQuerySizeToLog, setMaxReconnects, setMaxRows, setMetadataCacheSize, setNetTimeoutForStreamingResults, setNoAccessToProcedureBodies, setNoDatetimeStringSync, setNoTimezoneConversionForDateType, setNoTimezoneConversionForTimeType, setNullCatalogMeansCurrent, setNullNamePatternMatchesAll, setOverrideSupportsIntegrityEnhancementFacility, setPacketDebugBufferSize, setPadCharsWithSpace, setParanoid, setParseInfoCacheFactory, setPasswordCharacterEncoding, setPedantic, setPinGlobalTxToPhysicalConnection, setPopulateInsertRowWithDefaultValues, setPreparedStatementCacheSize, setPreparedStatementCacheSqlLimit, setPrepStmtCacheSize, setPrepStmtCacheSqlLimit, setProcessEscapeCodesForPrepStmts, setProfilerEventHandler, setProfileSql, setProfileSQL, setPropertiesTransform, setQueriesBeforeRetryMaster, setQueryTimeoutKillsConnection, setReadFromMasterWhenNoSlaves, setReadOnlyPropagatesToServer, setReconnectAtTxEnd, setRelaxAutoCommit, setReplicationEnableJMX, setReportMetricsIntervalMillis, setRequireSSL, setResourceId, setResultSetSizeThreshold, setRetainStatementAfterResultSetClose, setRetriesAllDown, setRewriteBatchedStatements, setRollbackOnPooledClose, setRoundRobinLoadBalance, setRunningCTS13, setSecondsBeforeRetryMaster, setSelfDestructOnPingMaxOperations, setSelfDestructOnPingSecondsLifetime, setSendFractionalSeconds, setServerAffinityOrder, setServerConfigCacheFactory, setServerRSAPublicKeyFile, setServerTimezone, setSessionVariables, setSlowQueryThresholdMillis, setSlowQueryThresholdNanos, setSocketFactory, setSocketFactoryClassName, setSocketTimeout, setSocksProxyHost, setSocksProxyPort, 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, useUnbufferedInputMethods inherited from interface MySQLConnection
getConnectionAttributesMethods inherited from interface Wrapper
isWrapperFor, unwrap
-
Field Details
-
JDBC_LOCAL_CHARACTER_SET_RESULTS
- See Also:
-
charsetMap
The mapping between MySQL charset names and Java charset names. Initialized by loadCharacterSetMapping() -
DEFAULT_LOGGER_CLASS
-
roundRobinStatsMap
-
indexToCustomMysqlCharset
-
props
Properties for this connection specified by user -
resultSetMetadataCache
Cache of ResultSet metadata
-
-
Constructor Details
-
ConnectionImpl
protected ConnectionImpl()' For the delegate only -
ConnectionImpl
public ConnectionImpl(String hostToConnectTo, int portToConnectTo, Properties info, String databaseToConnectTo, String url) throws SQLException Creates a connection to a MySQL Server.- Parameters:
hostToConnectTo- the hostname of the database serverportToConnectTo- the port number the server is listening oninfo- a Properties[] list holding the user and passworddatabaseToConnectTo- the database to connect tourl- the URL of the connectiond- the Driver instantation of the connection- Throws:
SQLException- if a database access error occurs
-
-
Method Details
-
getHost
- Specified by:
getHostin interfaceConnection- Specified by:
getHostin interfaceMySQLConnection
-
getHostPortPair
- Specified by:
getHostPortPairin interfaceMySQLConnection
-
isProxySet
public boolean isProxySet()- Specified by:
isProxySetin interfaceMySQLConnection
-
setProxy
- Specified by:
setProxyin interfaceConnection- Specified by:
setProxyin interfaceMySQLConnection
-
getLoadBalanceSafeProxy
Deprecated.replaced bygetMultiHostSafeProxy()- Specified by:
getLoadBalanceSafeProxyin interfaceMySQLConnection
-
getMultiHostSafeProxy
- Specified by:
getMultiHostSafeProxyin interfaceMySQLConnection
-
getActiveMySQLConnection
- Specified by:
getActiveMySQLConnectionin interfaceMySQLConnection
-
getConnectionMutex
- Specified by:
getConnectionMutexin interfaceConnection
-
appendMessageToException
protected static SQLException appendMessageToException(SQLException sqlEx, String messageToAppend, ExceptionInterceptor interceptor) -
getCancelTimer
- Specified by:
getCancelTimerin interfaceMySQLConnection
-
getInstance
protected static Connection getInstance(String hostToConnectTo, int portToConnectTo, Properties info, String databaseToConnectTo, String url) throws 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:
SQLException
-
getNextRoundRobinHostIndex
-
unSafeStatementInterceptors
- Specified by:
unSafeStatementInterceptorsin interfaceMySQLConnection- Throws:
SQLException
-
initializeSafeStatementInterceptors
- Specified by:
initializeSafeStatementInterceptorsin interfaceMySQLConnection- Throws:
SQLException
-
getStatementInterceptorsInstances
- Specified by:
getStatementInterceptorsInstancesin interfaceMySQLConnection
-
changeUser
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.- Specified by:
changeUserin interfaceConnection- Parameters:
userName- the username to authenticate withnewPassword- the password to authenticate with- Throws:
SQLException- if authentication fails, or some other error occurs while performing the command.
-
checkClosed
- Specified by:
checkClosedin interfaceConnection- Throws:
SQLException
-
throwConnectionClosedException
- Specified by:
throwConnectionClosedExceptionin interfaceMySQLConnection- Throws:
SQLException
-
abortInternal
Clobbers the physical network connection and marks this connection as closed.- Specified by:
abortInternalin interfaceConnection- Throws:
SQLException
-
clearHasTriedMaster
Deprecated.- Specified by:
clearHasTriedMasterin interfaceConnection
-
clearWarnings
After this call, getWarnings returns null until a new warning is reported for this connection.- Specified by:
clearWarningsin interfaceConnection- Throws:
SQLException- if a database access error occurs
-
clientPrepareStatement
Description copied from interface:ConnectionPrepares 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.- Specified by:
clientPrepareStatementin interfaceConnection- Parameters:
sql-- Throws:
SQLException- See Also:
-
clientPrepareStatement
public PreparedStatement clientPrepareStatement(String sql, int autoGenKeyIndex) throws SQLException Description copied from interface:ConnectionPrepares 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.- Specified by:
clientPrepareStatementin interfaceConnection- Throws:
SQLException- See Also:
-
clientPrepareStatement
public PreparedStatement clientPrepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException Description copied from interface:ConnectionPrepares 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.- Specified by:
clientPrepareStatementin interfaceConnection- Parameters:
sql-resultSetType-resultSetConcurrency-- Throws:
SQLException- See Also:
-
clientPrepareStatement
public PreparedStatement clientPrepareStatement(String sql, int resultSetType, int resultSetConcurrency, boolean processEscapeCodesIfNeeded) throws SQLException - Throws:
SQLException
-
clientPrepareStatement
public PreparedStatement clientPrepareStatement(String sql, int[] autoGenKeyIndexes) throws SQLException Description copied from interface:ConnectionPrepares 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.- Specified by:
clientPrepareStatementin interfaceConnection- Throws:
SQLException- See Also:
-
clientPrepareStatement
public PreparedStatement clientPrepareStatement(String sql, String[] autoGenKeyColNames) throws SQLException Description copied from interface:ConnectionPrepares 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.- Specified by:
clientPrepareStatementin interfaceConnection- Throws:
SQLException- See Also:
-
clientPrepareStatement
public PreparedStatement clientPrepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException Description copied from interface:ConnectionPrepares 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.- Specified by:
clientPrepareStatementin interfaceConnection- Throws:
SQLException- See Also:
-
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. Certain fatal errors also result in a closed connection.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceConnection- Throws:
SQLException- if a database access error occurs
-
commit
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:
commitin interfaceConnection- Throws:
SQLException- if a database access error occurs- See Also:
-
createNewIO
Creates an IO channel to the server- Specified by:
createNewIOin interfaceMySQLConnection- Parameters:
isForReconnect- is this request for a re-connect- Throws:
SQLException- if a database access error occursCommunicationsException
-
createStatement
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:
createStatementin interfaceConnection- Returns:
- a new Statement object
- Throws:
SQLException- passed through from the constructor
-
createStatement
JDBC 2.0 Same as createStatement() above, but allows the default result set type and result set concurrency type to be overridden.- Specified by:
createStatementin interfaceConnection- Parameters:
resultSetType- a result set type, see ResultSet.TYPE_XXXresultSetConcurrency- a concurrency type, see ResultSet.CONCUR_XXX- Returns:
- a new Statement object
- Throws:
SQLException- if a database-access error occurs.
-
createStatement
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
createStatementin interfaceConnection- Throws:
SQLException- See Also:
-
dumpTestcaseQuery
- Specified by:
dumpTestcaseQueryin interfaceMySQLConnection
-
duplicate
- Specified by:
duplicatein interfaceMySQLConnection- Throws:
SQLException
-
execSQL
public ResultSetInternalMethods execSQL(StatementImpl callingStatement, String sql, int maxRows, Buffer packet, int resultSetType, int resultSetConcurrency, boolean streamResults, String catalog, Field[] cachedMetadata) throws 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:
execSQLin interfaceMySQLConnection- Parameters:
callingStatement-sql- the SQL statement to be executedmaxRows-packet-resultSetType-resultSetConcurrency-streamResults-catalog-queryIsSelectOnly-unpackFields-- Returns:
- a ResultSet holding the results
- Throws:
SQLException- if a database error occurs
-
execSQL
public ResultSetInternalMethods execSQL(StatementImpl callingStatement, String sql, int maxRows, Buffer packet, int resultSetType, int resultSetConcurrency, boolean streamResults, String catalog, Field[] cachedMetadata, boolean isBatch) throws SQLException - Specified by:
execSQLin interfaceMySQLConnection- Throws:
SQLException
-
extractSqlFromPacket
public String extractSqlFromPacket(String possibleSqlQuery, Buffer queryPacket, int endOfQueryPacketPosition) throws SQLException - Specified by:
extractSqlFromPacketin interfaceMySQLConnection- Throws:
SQLException
-
generateConnectionCommentBlock
- Specified by:
generateConnectionCommentBlockin interfaceMySQLConnection
-
getActiveStatementCount
public int getActiveStatementCount()Description copied from interface:ConnectionReturns the number of statements active on this connection, which haven't been .close()d.- Specified by:
getActiveStatementCountin interfaceConnection- Specified by:
getActiveStatementCountin interfaceMySQLConnection
-
getAutoCommit
Gets the current auto-commit state- Specified by:
getAutoCommitin interfaceConnection- Returns:
- Current state of auto-commit
- Throws:
SQLException- if an error occurs- See Also:
-
getCalendarInstanceForSessionOrNew
Optimization to only use one calendar per-session, or calculate it for each call, depending on user configuration- Specified by:
getCalendarInstanceForSessionOrNewin interfaceMySQLConnection
-
getCatalog
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:
getCatalogin interfaceConnection- Returns:
- the current catalog name or null
- Throws:
SQLException- if a database access error occurs
-
getCharacterSetMetadata
- Specified by:
getCharacterSetMetadatain interfaceMySQLConnection- Returns:
- Returns the characterSetMetadata.
-
getCharsetConverter
Returns the locally mapped instance of a charset converter (to avoid overhead of static synchronization).- Specified by:
getCharsetConverterin interfaceMySQLConnection- Parameters:
javaEncodingName- the encoding name to retrieve- Returns:
- a character converter, or null if one couldn't be mapped.
- Throws:
SQLException
-
getCharsetNameForIndex
Deprecated.replaced bygetEncodingForIndex(int charsetIndex)- Specified by:
getCharsetNameForIndexin interfaceMySQLConnection- Throws:
SQLException
-
getEncodingForIndex
Returns the Java character encoding name for the given MySQL server charset index- Specified by:
getEncodingForIndexin interfaceMySQLConnection- Parameters:
charsetIndex-- Returns:
- the Java character encoding name for the given MySQL server charset index
- Throws:
SQLException- if the character set index isn't known by the driver
-
getDefaultTimeZone
- Specified by:
getDefaultTimeZonein interfaceMySQLConnection- Returns:
- Returns the defaultTimeZone.
-
getErrorMessageEncoding
- Specified by:
getErrorMessageEncodingin interfaceMySQLConnection
-
getHoldability
- Specified by:
getHoldabilityin interfaceConnection- Throws:
SQLException- See Also:
-
getId
public long getId()- Specified by:
getIdin interfaceMySQLConnection
-
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:
getIdleForin interfaceConnection- Specified by:
getIdleForin interfaceMySQLConnection- Returns:
- number of ms that this connection has been idle, 0 if the driver is busy retrieving results.
-
getIO
Returns the IO channel to the server- Specified by:
getIOin interfaceMySQLConnection- Returns:
- the IO channel to the server
- Throws:
SQLException- if the connection is closed.
-
getLog
Returns the log mechanism that should be used to log information from/for this Connection.- Specified by:
getLogin interfaceConnection- Specified by:
getLogin interfaceMySQLConnection- Returns:
- the Log instance to use for logging messages.
- Throws:
SQLException- if an error occurs
-
getMaxBytesPerChar
- Specified by:
getMaxBytesPerCharin interfaceMySQLConnection- Throws:
SQLException
-
getMaxBytesPerChar
- Specified by:
getMaxBytesPerCharin interfaceMySQLConnection- Throws:
SQLException
-
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. This information is made available through a DatabaseMetaData object.- Specified by:
getMetaDatain interfaceConnection- Returns:
- a DatabaseMetaData object for this connection
- Throws:
SQLException- if a database access error occurs
-
getMetadataSafeStatement
- Specified by:
getMetadataSafeStatementin interfaceMySQLConnection- Throws:
SQLException
-
getMetadataSafeStatement
- Throws:
SQLException
-
getNetBufferLength
public int getNetBufferLength()Returns the packet buffer size the MySQL server reported upon connection- Specified by:
getNetBufferLengthin interfaceMySQLConnection
-
getServerCharacterEncoding
Deprecated.replaced bygetServerCharset()Description copied from interface:ConnectionReturns the server's character set- Specified by:
getServerCharacterEncodingin interfaceConnection- Returns:
- the server's character set.
-
getServerCharset
Returns the server's character set- Specified by:
getServerCharsetin interfaceConnection- Specified by:
getServerCharsetin interfaceMySQLConnection- Returns:
- the server's character set.
-
getServerMajorVersion
public int getServerMajorVersion()- Specified by:
getServerMajorVersionin interfaceMySQLConnection
-
getServerMinorVersion
public int getServerMinorVersion()- Specified by:
getServerMinorVersionin interfaceMySQLConnection
-
getServerSubMinorVersion
public int getServerSubMinorVersion()- Specified by:
getServerSubMinorVersionin interfaceMySQLConnection
-
getServerTimezoneTZ
Description copied from interface:ConnectionReturns the TimeZone that represents the configured timezone for the server.- Specified by:
getServerTimezoneTZin interfaceConnection- Specified by:
getServerTimezoneTZin interfaceMySQLConnection
-
getServerVariable
- Specified by:
getServerVariablein interfaceMySQLConnection
-
getServerVersion
- Specified by:
getServerVersionin interfaceMySQLConnection
-
getSessionLockedCalendar
- Specified by:
getSessionLockedCalendarin interfaceMySQLConnection
-
getTransactionIsolation
Get this Connection's current transaction isolation mode.- Specified by:
getTransactionIsolationin interfaceConnection- Returns:
- the current TRANSACTION_ mode value
- Throws:
SQLException- if a database access error occurs
-
getTypeMap
JDBC 2.0 Get the type-map object associated with this connection. By default, the map returned is empty.- Specified by:
getTypeMapin interfaceConnection- Returns:
- the type map
- Throws:
SQLException- if a database error occurs
-
getURL
- Specified by:
getURLin interfaceMySQLConnection
-
getUser
- Specified by:
getUserin interfaceMySQLConnection
-
getUtcCalendar
- Specified by:
getUtcCalendarin interfaceMySQLConnection
-
getWarnings
The first warning reported by calls on this Connection is returned. Note: Sebsequent warnings will be changed to this java.sql.SQLWarning- Specified by:
getWarningsin interfaceConnection- Returns:
- the first java.sql.SQLWarning or null
- Throws:
SQLException- if a database access error occurs
-
hasSameProperties
Description copied from interface:ConnectionDoes this connection have the same properties as another?- Specified by:
hasSamePropertiesin interfaceConnection
-
getProperties
Description copied from interface:ConnectionReturns the parsed and passed in properties for this connection.- Specified by:
getPropertiesin interfaceConnection- Specified by:
getPropertiesin interfaceMySQLConnection
-
hasTriedMaster
Deprecated.Description copied from interface:ConnectionHas this connection tried to execute a query on the "master" server (first host in a multiple host list).- Specified by:
hasTriedMasterin interfaceConnection
-
incrementNumberOfPreparedExecutes
public void incrementNumberOfPreparedExecutes()- Specified by:
incrementNumberOfPreparedExecutesin interfaceMySQLConnection
-
incrementNumberOfPrepares
public void incrementNumberOfPrepares()- Specified by:
incrementNumberOfPreparesin interfaceMySQLConnection
-
incrementNumberOfResultSetsCreated
public void incrementNumberOfResultSetsCreated()- Specified by:
incrementNumberOfResultSetsCreatedin interfaceMySQLConnection
-
isQueryCacheEnabled
public boolean isQueryCacheEnabled() -
isClientTzUTC
public boolean isClientTzUTC()- Specified by:
isClientTzUTCin interfaceMySQLConnection
-
isClosed
public boolean isClosed()- Specified by:
isClosedin interfaceConnection
-
isCursorFetchEnabled
- Specified by:
isCursorFetchEnabledin interfaceMySQLConnection- Throws:
SQLException
-
isInGlobalTx
public boolean isInGlobalTx()Description copied from interface:ConnectionIs this connection currently a participant in an XA transaction?- Specified by:
isInGlobalTxin interfaceConnection
-
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?- Specified by:
isMasterConnectionin interfaceConnection- 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?- Specified by:
isNoBackslashEscapesSetin interfaceConnection- Returns:
- Returns the noBackslashEscapes.
-
isReadInfoMsgEnabled
public boolean isReadInfoMsgEnabled()- Specified by:
isReadInfoMsgEnabledin interfaceMySQLConnection
-
isReadOnly
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:
isReadOnlyin interfaceConnection- Specified by:
isReadOnlyin interfaceMySQLConnection- Returns:
- true if the connection is read only
- Throws:
SQLException- if a database access error occurs
-
isReadOnly
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:
isReadOnlyin interfaceMySQLConnection- 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:
SQLException- if a database access error occurs
-
isRunningOnJDK13
public boolean isRunningOnJDK13()- Specified by:
isRunningOnJDK13in interfaceMySQLConnection
-
isSameResource
Description copied from interface:ConnectionDoes this connection have the same resource name as the given connection (for XA)?- Specified by:
isSameResourcein interfaceConnection- Parameters:
otherConnection-
-
isServerTzUTC
public boolean isServerTzUTC()- Specified by:
isServerTzUTCin interfaceMySQLConnection
-
getAutoIncrementIncrement
public int getAutoIncrementIncrement()Description copied from interface:ConnectionReturns the -session- value of 'auto_increment_increment' from the server if it exists, or '1' if not.- Specified by:
getAutoIncrementIncrementin interfaceConnection- Specified by:
getAutoIncrementIncrementin interfaceMySQLConnection
-
lowerCaseTableNames
public boolean lowerCaseTableNames()Is the server configured to use lower-case table names only?- Specified by:
lowerCaseTableNamesin interfaceConnection- Specified by:
lowerCaseTableNamesin interfaceMySQLConnection- Returns:
- true if lower_case_table_names is 'on'
-
nativeSQL
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:
nativeSQLin interfaceConnection- Parameters:
sql- a SQL statement that may contain one or more '?' parameter placeholders- Returns:
- the native form of this statement
- Throws:
SQLException- if a database access error occurs
-
parserKnowsUnicode
public boolean parserKnowsUnicode()Description copied from interface:ConnectionDoes the server this connection is connected to support unicode?- Specified by:
parserKnowsUnicodein interfaceConnection
-
ping
Detect if the connection is still good- Specified by:
pingin interfaceConnection- Throws:
SQLException- if the ping fails
-
pingInternal
- Specified by:
pingInternalin interfaceMySQLConnection- Throws:
SQLException
-
prepareCall
- Specified by:
prepareCallin interfaceConnection- Parameters:
sql-- Throws:
SQLException
-
prepareCall
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws 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:
prepareCallin interfaceConnection- Parameters:
sql- the SQL representing the callable statementresultSetType- a result set type, see ResultSet.TYPE_XXXresultSetConcurrency- a concurrency type, see ResultSet.CONCUR_XXX- Returns:
- a new CallableStatement object containing the pre-compiled SQL statement
- Throws:
SQLException- if a database-access error occurs.
-
prepareCall
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
prepareCallin interfaceConnection- Throws:
SQLException- See Also:
-
prepareStatement
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:
prepareStatementin interfaceConnection- 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:
SQLException- if a database access error occurs.
-
prepareStatement
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException- See Also:
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws 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:
prepareStatementin interfaceConnection- Parameters:
sql- the SQL query containing place holdersresultSetType- a result set type, see ResultSet.TYPE_XXXresultSetConcurrency- a concurrency type, see ResultSet.CONCUR_XXX- Returns:
- a new PreparedStatement object containing the pre-compiled SQL statement
- Throws:
SQLException- if a database-access error occurs.
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException- See Also:
-
prepareStatement
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException- See Also:
-
prepareStatement
public PreparedStatement prepareStatement(String sql, String[] autoGenKeyColNames) throws SQLException - Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException- See Also:
-
realClose
public void realClose(boolean calledExplicitly, boolean issueRollback, boolean skipLocalTeardown, Throwable reason) throws SQLException Closes connection and frees resources.- Specified by:
realClosein interfaceMySQLConnection- Parameters:
calledExplicitly- is this being called from close()issueRollback- should a rollback() be issued?- Throws:
SQLException- if an error occurs
-
recachePreparedStatement
- Specified by:
recachePreparedStatementin interfaceMySQLConnection- Throws:
SQLException
-
decachePreparedStatement
- Specified by:
decachePreparedStatementin interfaceMySQLConnection- Throws:
SQLException
-
registerQueryExecutionTime
public void registerQueryExecutionTime(long queryTimeMs) - Specified by:
registerQueryExecutionTimein interfaceMySQLConnection- Parameters:
queryTimeMs-
-
registerStatement
Register a Statement instance as open.- Specified by:
registerStatementin interfaceMySQLConnection- Parameters:
stmt- the Statement instance to remove
-
releaseSavepoint
- Specified by:
releaseSavepointin interfaceConnection- Throws:
SQLException- See Also:
-
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:
reportNumberOfTablesAccessedin interfaceMySQLConnection
-
resetServerState
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.- Specified by:
resetServerStatein interfaceConnection- Throws:
SQLException- if the operation fails while resetting server state.
-
rollback
The method rollback() drops all changes made since the previous commit/rollback and releases any database locks currently held by the Connection.- Specified by:
rollbackin interfaceConnection- Throws:
SQLException- if a database access error occurs- See Also:
-
rollback
- Specified by:
rollbackin interfaceConnection- Throws:
SQLException- See Also:
-
serverPrepareStatement
Description copied from interface:ConnectionPrepares 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.- Specified by:
serverPrepareStatementin interfaceConnection- Throws:
SQLException- See Also:
-
serverPrepareStatement
public PreparedStatement serverPrepareStatement(String sql, int autoGenKeyIndex) throws SQLException Description copied from interface:ConnectionPrepares 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.- Specified by:
serverPrepareStatementin interfaceConnection- Throws:
SQLException- See Also:
-
serverPrepareStatement
public PreparedStatement serverPrepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException Description copied from interface:ConnectionPrepares 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.- Specified by:
serverPrepareStatementin interfaceConnection- Throws:
SQLException- See Also:
-
serverPrepareStatement
public PreparedStatement serverPrepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException Description copied from interface:ConnectionPrepares 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.- Specified by:
serverPrepareStatementin interfaceConnection- Throws:
SQLException- See Also:
-
serverPrepareStatement
public PreparedStatement serverPrepareStatement(String sql, int[] autoGenKeyIndexes) throws SQLException Description copied from interface:ConnectionPrepares 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.- Specified by:
serverPrepareStatementin interfaceConnection- Throws:
SQLException- See Also:
-
serverPrepareStatement
public PreparedStatement serverPrepareStatement(String sql, String[] autoGenKeyColNames) throws SQLException Description copied from interface:ConnectionPrepares 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.- Specified by:
serverPrepareStatementin interfaceConnection- Throws:
SQLException- See Also:
-
serverSupportsConvertFn
- Specified by:
serverSupportsConvertFnin interfaceMySQLConnection- Throws:
SQLException
-
setAutoCommit
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.- Specified by:
setAutoCommitin interfaceConnection- Parameters:
autoCommitFlag- true enables auto-commit; false disables it- Throws:
SQLException- if a database access error occurs
-
setCatalog
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 requestNote: MySQL's notion of catalogs are individual databases.
- Specified by:
setCatalogin interfaceConnection- Parameters:
catalog- the database for this connection to use- Throws:
SQLException- if a database access error occurs
-
setFailedOver
public void setFailedOver(boolean flag) - Specified by:
setFailedOverin interfaceConnection- Parameters:
failedOver- The failedOver to set.
-
setHoldability
- Specified by:
setHoldabilityin interfaceConnection- Throws:
SQLException- See Also:
-
setInGlobalTx
public void setInGlobalTx(boolean flag) Description copied from interface:ConnectionSet the state of being in a global (XA) transaction.- Specified by:
setInGlobalTxin interfaceConnection- Parameters:
flag-
-
setPreferSlaveDuringFailover
Deprecated.- Specified by:
setPreferSlaveDuringFailoverin interfaceConnection- Parameters:
preferSlaveDuringFailover- The preferSlaveDuringFailover to set.
-
setReadInfoMsgEnabled
public void setReadInfoMsgEnabled(boolean flag) - Specified by:
setReadInfoMsgEnabledin interfaceMySQLConnection
-
setReadOnly
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:
setReadOnlyin interfaceConnection- Parameters:
readOnlyFlag- - true enables read-only mode; false disables it- Throws:
SQLException- if a database access error occurs
-
setReadOnlyInternal
- Specified by:
setReadOnlyInternalin interfaceMySQLConnection- Throws:
SQLException
-
setSavepoint
- Specified by:
setSavepointin interfaceConnection- Throws:
SQLException- See Also:
-
setSavepoint
- Specified by:
setSavepointin interfaceConnection- Throws:
SQLException- See Also:
-
setTransactionIsolation
- Specified by:
setTransactionIsolationin interfaceConnection- Parameters:
level-- Throws:
SQLException
-
setTypeMap
JDBC 2.0 Install a type-map object as the default type-map for this connection- Specified by:
setTypeMapin interfaceConnection- Parameters:
map- the type mapping- Throws:
SQLException- if a database error occurs.
-
shutdownServer
Used by MiniAdmin to shutdown a MySQL server- Specified by:
shutdownServerin interfaceConnection- Specified by:
shutdownServerin interfaceMySQLConnection- Throws:
SQLException- if the command can not be issued.
-
supportsIsolationLevel
public boolean supportsIsolationLevel()Description copied from interface:ConnectionDoes the server this connection is connected to support isolation levels?- Specified by:
supportsIsolationLevelin interfaceConnection
-
supportsQuotedIdentifiers
public boolean supportsQuotedIdentifiers()Description copied from interface:ConnectionDoes the server this connection is connected to support quoted identifiers?- Specified by:
supportsQuotedIdentifiersin interfaceConnection
-
supportsTransactions
public boolean supportsTransactions()Description copied from interface:ConnectionDoes the server this connection is connected to support transactions?- Specified by:
supportsTransactionsin interfaceConnection
-
unregisterStatement
Remove the given statement from the list of open statements- Specified by:
unregisterStatementin interfaceMySQLConnection- Parameters:
stmt- the Statement instance to remove
-
useAnsiQuotedIdentifiers
public boolean useAnsiQuotedIdentifiers()- Specified by:
useAnsiQuotedIdentifiersin interfaceMySQLConnection
-
versionMeetsMinimum
Description copied from interface:ConnectionDoes the server this connection is connected to meet or exceed the given version?- Specified by:
versionMeetsMinimumin interfaceConnection- Throws:
SQLException
-
getCachedMetaData
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:
getCachedMetaDatain interfaceMySQLConnection- 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(String sql, CachedResultSetMetaData cachedMetaData, ResultSetInternalMethods resultSet) throws 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:
initializeResultsMetadataFromCachein interfaceMySQLConnection- 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:
SQLException
-
getStatementComment
Returns the comment that will be prepended to all statements sent to the server.- Specified by:
getStatementCommentin interfaceConnection- Specified by:
getStatementCommentin interfaceMySQLConnection- Returns:
- the comment that will be prepended to all statements sent to the server.
-
setStatementComment
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.- Specified by:
setStatementCommentin interfaceConnection- Parameters:
comment- the comment that will be prepended to all statements sent to the server.
-
reportQueryTime
public void reportQueryTime(long millisOrNanos) - Specified by:
reportQueryTimein interfaceConnection
-
isAbonormallyLongQuery
public boolean isAbonormallyLongQuery(long millisOrNanos) Description copied from interface:MySQLConnectionUpdate statistics that allows the driver to determine if a query is slow enough to be logged, and return the estimation result for millisOrNanos value.Used in case autoSlowLog=true.
- Specified by:
isAbonormallyLongQueryin interfaceConnection- Specified by:
isAbonormallyLongQueryin interfaceMySQLConnection- Parameters:
millisOrNanos- query execution time- Returns:
- true if millisOrNanos is outside the 99th percentile?
-
initializeExtension
- Specified by:
initializeExtensionin interfaceConnection- Throws:
SQLException
-
transactionBegun
- Specified by:
transactionBegunin interfaceMySQLConnection- Throws:
SQLException
-
transactionCompleted
- Specified by:
transactionCompletedin interfaceMySQLConnection- Throws:
SQLException
-
storesLowerCaseTableName
public boolean storesLowerCaseTableName()- Specified by:
storesLowerCaseTableNamein interfaceMySQLConnection
-
getExceptionInterceptor
- Specified by:
getExceptionInterceptorin interfaceConnectionProperties- Specified by:
getExceptionInterceptorin interfaceMySQLConnection- Overrides:
getExceptionInterceptorin classConnectionPropertiesImpl
-
getRequiresEscapingEncoder
public boolean getRequiresEscapingEncoder()- Specified by:
getRequiresEscapingEncoderin interfaceMySQLConnection
-
isServerLocal
Description copied from interface:ConnectionIs the server this connection is connected to "local" (i.e. same host) as the application?- Specified by:
isServerLocalin interfaceConnection- Throws:
SQLException
-
getSessionMaxRows
public int getSessionMaxRows()Returns the sql select limit max-rows for this session.- Specified by:
getSessionMaxRowsin interfaceConnection
-
setSessionMaxRows
Sets the sql select limit max-rows for this session if different from current.- Specified by:
setSessionMaxRowsin interfaceConnection- Parameters:
max- the new max-rows value to set.- Throws:
SQLException- if a database error occurs issuing the statement that sets the limit.
-
setSchema
- Specified by:
setSchemain interfaceConnection- Specified by:
setSchemain interfaceConnection- Throws:
SQLException
-
getSchema
- Specified by:
getSchemain interfaceConnection- Specified by:
getSchemain interfaceConnection- Throws:
SQLException
-
abort
Terminates an open connection. Callingabortresults in:- The connection marked as closed
- Closes any physical connection to the database
- Releases resources used by the connection
- Insures that any thread that is currently accessing the connection will either progress to completion or throw an
SQLException.
Calling
abortmarks the connection closed and releases any resources. Callingaborton 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
abortmethod returns, the connection will have been marked as closed and theExecutorthat was passed as a parameter to abort may still be executing tasks to release resources.This method checks to see that there is an
SQLPermissionobject before allowing the method to proceed. If aSecurityManagerexists and itscheckPermissionmethod denies callingabort, this method throws ajava.lang.SecurityException.- Specified by:
abortin interfaceConnection- Specified by:
abortin interfaceConnection- Parameters:
executor- TheExecutorimplementation which will be used byabort.- Throws:
SQLException- if a database access error occurs or theexecutorisnull,SecurityException- if a security manager exists and itscheckPermissionmethod denies callingabort- Since:
- 1.7
- See Also:
-
setNetworkTimeout
- Specified by:
setNetworkTimeoutin interfaceConnection- Specified by:
setNetworkTimeoutin interfaceConnection- Throws:
SQLException
-
getNetworkTimeout
- Specified by:
getNetworkTimeoutin interfaceConnection- Specified by:
getNetworkTimeoutin interfaceConnection- Throws:
SQLException
-
getProfilerEventHandlerInstance
public com.mysql.jdbc.profiler.ProfilerEventHandler getProfilerEventHandlerInstance()- Specified by:
getProfilerEventHandlerInstancein interfaceMySQLConnection
-
setProfilerEventHandlerInstance
public void setProfilerEventHandlerInstance(com.mysql.jdbc.profiler.ProfilerEventHandler h) - Specified by:
setProfilerEventHandlerInstancein interfaceMySQLConnection
-
isServerTruncatesFracSecs
public boolean isServerTruncatesFracSecs()- Specified by:
isServerTruncatesFracSecsin interfaceMySQLConnection
-
getQueryTimingUnits
- Specified by:
getQueryTimingUnitsin interfaceMySQLConnection
-
getEncodingForIndex(int charsetIndex)