|
|||||||||
| Home >> All >> com >> mysql >> [ jdbc overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.mysql.jdbc
Class Connection

java.lang.Objectcom.mysql.jdbc.Connection
- All Implemented Interfaces:
- java.sql.Connection
- public class Connection
- extends java.lang.Object
- implements java.sql.Connection
- extends java.lang.Object
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.
- Version:
- $Id: Connection.java,v 1.31.2.85 2004/11/15 00:23:07 mmatthew Exp $
| Nested Class Summary | |
(package private) class |
Connection.UltraDevWorkAround
Wrapper class for UltraDev CallableStatements that are really PreparedStatments. |
| Field Summary | |
private boolean |
allowLoadLocalInfile
Allow LOAD LOCAL INFILE (defaults to true) |
private boolean |
alwaysClearStream
Should we clear the input stream each query? |
private boolean |
autoCommit
Are we in autoCommit mode? |
private java.util.Map |
cachedPreparedStatementParams
A map of SQL to parsed prepared statement parameters. |
private boolean |
cachePreparedStatements
SHould we cache the parsing of prepared statements? |
private boolean |
capitalizeDBMDTypes
Should we capitalize mysql types |
private java.lang.String |
characterSetMetadata
For servers > 4.1.0, what character set is the metadata returned in? |
private java.lang.String |
characterSetResults
The character set we want results and result metadata returned in (null == results in any charset, metadata in UTF-8). |
private java.lang.String |
characterSetResultsOnServer
The character set we want results and result metadata returned in (null == results in any charset, metadata in UTF-8). |
private static java.lang.Object |
CHARSET_CONVERTER_NOT_AVAILABLE_MARKER
Marker for character set converter not being available (not written, multibyte, etc) Used to prevent multiple instantiation requests. |
private java.util.Map |
charsetConverterMap
Holds cached mappings to charset converters to avoid static synchronization and at the same time save memory (each charset converter takes approx 65K of static data). |
private static java.util.Map |
charsetMap
The mapping between MySQL charset names and Java charset names. |
private boolean |
clobberStreamingResults
Should we clobber streaming results on new queries, or issue an error? |
private boolean |
continueBatchOnError
Should we continue processing batch commands if one fails. |
private java.lang.String |
database
The database we're currently using (called Catalog in JDBC terms). |
private DatabaseMetaData |
dbmd
Internal DBMD to use for various database-version specific features |
private static java.lang.String |
DEFAULT_SOCKET_FACTORY
Default socket factory classname |
private java.util.TimeZone |
defaultTimeZone
|
private boolean |
doUnicode
Should we do unicode character conversions? |
private java.lang.String |
encoding
If we're doing unicode character conversions, what encoding do we use? |
private java.lang.Throwable |
explicitCloseLocation
Where was the connection _explicitly_ closed by the application? |
private boolean |
failedOver
Are we failed-over to a non-master host |
private boolean |
failOverReadOnly
When failed-over, set connection to read-only? |
private java.lang.Throwable |
forcedCloseReason
If the connection was forced closed, why was it forced closed? |
private boolean |
hasIsolationLevels
Does the server suuport isolation levels? |
private boolean |
hasQuotedIdentifiers
Does this version of MySQL support quoted identifiers? |
private boolean |
highAvailability
|
private java.lang.String |
host
The hostname we're connected to |
private java.util.List |
hostList
The list of host(s) to try and connect to |
private int |
hostListSize
How many hosts are in the host list? |
private boolean |
ignoreNonTxTables
Ignore non-transactional table warning for rollback? |
private java.lang.String[] |
indexToCharsetMapping
We need this 'bootstrapped', because 4.1 and newer will send fields back with this even before we fill this dynamically from the server. |
private double |
initialTimeout
|
private MysqlIO |
io
The I/O abstraction interface (network conn to MySQL server |
private boolean |
isClosed
Has this connection been closed? |
private boolean |
isInteractiveClient
Should we tell MySQL that we're an interactive client? |
private int |
isolationLevel
isolation level |
private long |
lastQueryFinishedTime
When did the last query finish? |
private boolean |
lowerCaseTableNames
Is the server configured to use lower-case table names only? |
private static java.util.Map |
mapTransIsolationName2Value
Map mysql transaction isolation level name to java.sql.Connection.TRANSACTION_XXX |
private long |
masterFailTimeMillis
When did the master fail? |
private int |
maxAllowedPacket
The largest packet we can send (changed once we know what the server supports, we get this at connection init). |
private int |
maxReconnects
|
private int |
maxRows
The max rows that a result set can contain. |
private boolean |
maxRowsChanged
Has the max-rows setting been changed from the default? |
private static java.util.Map |
multibyteCharsetsMap
Table of multi-byte charsets. |
private java.lang.Object |
mutex
Mutex |
private NonRegisteringDriver |
myDriver
The driver instance that created us |
private java.lang.String |
mysqlEncodingName
What does MySQL call this encoding? |
private java.lang.String |
myURL
The JDBC URL we're using |
private boolean |
needsPing
|
private java.lang.String |
negativeInfinityRep
|
private boolean |
negativeInfinityRepIsClipped
|
private int |
netBufferLength
|
private java.lang.String |
notANumberRep
|
private boolean |
notANumberRepIsClipped
|
private boolean |
paranoid
Do we expose sensitive information in exception and error messages? |
(package private) boolean |
parserKnowsUnicode
|
private java.lang.String |
password
The password we used |
private boolean |
pedantic
Should we do 'extra' sanity checks? |
private static java.lang.String |
PING_COMMAND
|
private int |
port
The port number we're connected to (defaults to 3306) |
private java.lang.String |
positiveInfinityRep
|
private boolean |
positiveInfinityRepIsClipped
|
private int |
preparedStatementCacheMaxSqlSize
If prepared statement caching is enabled, what should the threshold length of the SQL to prepare should be in order to _not_ cache? |
private int |
preparedStatementCacheSize
If prepared statement caching is enabled, how many should we cache? |
private java.util.Properties |
props
Properties for this connection specified by user |
private int |
queriesBeforeRetryMaster
How many queries should we wait before we try to re-connect to the master, when we are failing over to replicated hosts Defaults to 50 |
private long |
queriesIssuedFailedOver
Number of queries we've issued since the master failed |
private boolean |
readInfoMsg
Should we retrieve 'info' messages from the server? |
private boolean |
readOnly
Are we in read-only mode? |
private boolean |
reconnectAtTxEnd
If autoReconnect == true, should we attempt to reconnect at transaction boundaries? |
private boolean |
relaxAutoCommit
Do we relax the autoCommit semantics? (For enhydra, for example) |
private boolean |
rollbackOnPooledClose
Should rollback() be called when pooled connections are closed? |
private long |
secondsBeforeRetryMaster
How many seconds should we wait before retrying to connect to the master if failed over? We fall back when either queriesBeforeRetryMaster or secondsBeforeRetryMaster is reached. |
private java.util.TimeZone |
serverTimezone
The timezone of the server |
private java.util.Map |
serverVariables
The map of server variables that we retrieve at connection init. |
private java.lang.String |
socketFactoryClassName
Classname for socket factory |
private int |
socketTimeout
What should we set the socket timeout to? |
private java.util.Map |
statementsUsingMaxRows
A map of statements that have had setMaxRows() called on them |
private boolean |
strictFloatingPoint
Do we need to correct endpoint rounding errors |
private boolean |
strictUpdates
Do we check all keys for updatable result sets? |
private boolean |
tinyint1isBit
|
private boolean |
transactionsSupported
Are transactions supported by the MySQL server we are connected to? |
private java.util.Map |
typeMap
The type map for UDTs (not implemented, but used by some third-party vendors, most notably IBM WebSphere) |
private boolean |
useAnsiQuotes
Has ANSI_QUOTES been enabled on the server? |
private boolean |
useCompression
Should we use compression? |
private boolean |
useFastPing
Can we use the "ping" command rather than a query? |
private boolean |
useHostsInPrivileges
Should we tack on hostname in DBMD.getTable/ColumnPrivileges()? |
private boolean |
useOnlyServerErrorMessages
Should we only use the error message from the server when reporting errors? |
private java.lang.String |
user
The user we're connected as |
private boolean |
useSSL
Should we use SSL? |
private boolean |
useStreamLengthsInPrepStmts
Should we use stream lengths in prepared statements? (true by default == JDBC compliant) |
private boolean |
useTimezone
Should we use timezone information? |
private boolean |
useUltraDevWorkAround
Should we return PreparedStatements for UltraDev's stupid bug? |
private boolean |
useUnbufferedInput
|
| Fields inherited from interface java.sql.Connection |
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE |
| Constructor Summary | |
(package private) |
Connection(java.lang.String host,
int port,
java.util.Properties info,
java.lang.String database,
java.lang.String url,
NonRegisteringDriver d)
Creates a connection to a MySQL Server. |
| Method Summary | |
boolean |
allowLoadLocalInfile()
Allow use of LOAD LOCAL INFILE? |
(package private) boolean |
alwaysClearStream()
|
private void |
buildCollationMapping()
Builds the map needed for 4.1.0 and newer servers that maps field-level charset/collation info to a java character encoding name. |
boolean |
capitalizeDBMDTypes()
DOCUMENT ME! |
void |
changeUser(java.lang.String userName,
java.lang.String newPassword)
Changes the user on this connection by performing a re-authentication. |
private void |
checkClosed()
|
private void |
checkServerEncoding()
If useUnicode flag is set and explicit client character encoding isn't specified then assign encoding from server if any. |
private void |
checkTransactionIsolationLevel()
Set transaction isolation level to the value received from server if any. |
private void |
cleanup(java.lang.Throwable cleanupReason)
Destroys this connection and any underlying resources |
void |
clearWarnings()
After this call, getWarnings returns null until a new warning is reported for this connection. |
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. |
private void |
configureCharsetProperties(java.util.Properties info)
Configures client-side properties for character set information. |
private boolean |
configureClientCharacterSet()
Sets up client character set for MySQL-4.1 and newer. |
private void |
configureTimezone()
Configures the client's timezone if required. |
(package private) boolean |
continueBatchOnError()
|
protected MysqlIO |
createNewIO(boolean isForReconnect)
Creates an IO channel to the server |
java.sql.Statement |
createStatement()
SQL statements without parameters are normally executed using Statement objects. |
java.sql.Statement |
createStatement(int resultSetType,
int resultSetConcurrency)
JDBC 2.0 Same as createStatement() above, but allows the default result set type and result set concurrency type to be overridden. |
java.sql.Statement |
createStatement(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
This method creates a new SQL statement with the specified type, concurrency and holdability, instead of using the defaults. |
private void |
detectFloatingPointStyle()
|
(package private) ResultSet |
execSQL(java.lang.String sql,
int maxRows,
Buffer packet,
int resultSetType,
boolean streamResults,
boolean queryIsSelectOnly,
java.lang.String catalog)
|
(package private) ResultSet |
execSQL(java.lang.String sql,
int maxRows,
Buffer packet,
int resultSetType,
java.lang.String catalog)
|
(package private) ResultSet |
execSQL(java.lang.String sql,
int maxRows,
Buffer packet,
java.lang.String catalog)
|
(package private) ResultSet |
execSQL(java.lang.String sql,
int maxRows,
int resultSetType,
boolean streamResults,
boolean queryIsSelectOnly,
java.lang.String catalog)
|
(package private) ResultSet |
execSQL(java.lang.String sql,
int maxRowsToRetreive,
java.lang.String catalog)
Send a query to the server. |
protected void |
finalize()
Cleanup the connection. |
boolean |
getAutoCommit()
gets the current auto-commit state |
java.lang.String |
getCatalog()
Return the connections current catalog name, or null if no catalog name is set, or we dont support catalogs. |
protected java.lang.String |
getCharacterSetMetadata()
|
(package private) SingleByteCharsetConverter |
getCharsetConverter(java.lang.String javaEncodingName)
Returns the locally mapped instance of a charset converter (to avoid overhead of static synchronization). |
protected java.lang.String |
getCharsetNameForIndex(int charsetIndex)
Returns the Java character encoding name for the given MySQL server charset index |
boolean |
getClobberStreamingResults()
Returns whether we clobber streaming results on new queries, or issue an error? |
protected java.util.TimeZone |
getDefaultTimeZone()
DOCUMENT ME! |
java.lang.String |
getEncoding()
Returns the character encoding for this Connection |
int |
getHoldability()
Gets the default holdability of ResultSetS that are created
from StatementS using this Connection. |
long |
getIdleFor()
NOT JDBC-Compliant, but clients can use this method to determine how long this connection has been idle. |
protected MysqlIO |
getIO()
Returns the IO channel to the server |
(package private) int |
getMaxAllowedPacket()
Returns the maximum packet size the MySQL server will accept |
(package private) int |
getMaxRows()
DOCUMENT ME! |
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. |
(package private) java.lang.Object |
getMutex()
Returns the Mutex all queries are locked against |
java.lang.String |
getNegativeInfinityRep()
DOCUMENT ME! |
(package private) int |
getNetBufferLength()
Returns the packet buffer size the MySQL server reported upon connection |
protected int |
getNetWriteTimeout()
|
java.lang.String |
getNotANumberRep()
DOCUMENT ME! |
java.lang.String |
getPositiveInfinityRep()
DOCUMENT ME! |
boolean |
getRollbackOnPooledClose()
|
protected java.lang.String |
getServerCharacterEncoding()
Returns the server's character set |
(package private) int |
getServerMajorVersion()
|
(package private) int |
getServerMinorVersion()
|
(package private) int |
getServerSubMinorVersion()
|
java.util.TimeZone |
getServerTimezone()
DOCUMENT ME! |
(package private) java.lang.String |
getServerVersion()
|
boolean |
getTinyint1isBit()
|
int |
getTransactionIsolation()
Get this Connection's current transaction isolation mode. |
java.util.Map |
getTypeMap()
JDBC 2.0 Get the type-map object associated with this connection. |
(package private) java.lang.String |
getURL()
|
protected boolean |
getUseOnlyServerErrorMessages()
|
(package private) java.lang.String |
getUser()
|
private boolean |
getUseUltraDevWorkAround()
|
java.sql.SQLWarning |
getWarnings()
The first warning reported by calls on this Connection is returned. |
private void |
initializeDriverProperties(java.util.Properties info)
Initializes driver properties that come from URL or properties passed to the driver manager. |
private void |
initializePropsFromServer(java.util.Properties info)
Sets varying properties that depend on server information. |
boolean |
isClosed()
DOCUMENT ME! |
boolean |
isInteractiveClient()
Should we tell MySQL that we're an interactive client |
boolean |
isNegativeInfinityRepIsClipped()
DOCUMENT ME! |
boolean |
isNotANumberRepIsClipped()
DOCUMENT ME! |
(package private) boolean |
isPedantic()
|
boolean |
isPositiveInfinityRepIsClipped()
DOCUMENT ME! |
(package private) boolean |
isReadInfoMsgEnabled()
|
boolean |
isReadOnly()
Tests to see if the connection is in Read Only Mode. |
protected boolean |
isUsingUnbufferedInput()
Is this connection using unbuffered input? |
private static void |
loadCharacterSetMapping()
Loads the mapping between MySQL character sets and Java character sets |
private void |
loadServerVariables()
Loads the result of 'SHOW VARIABLES' into the serverVariables field so that the driver can configure itself. |
boolean |
lowerCaseTableNames()
Is the server configured to use lower-case table names only? |
(package private) void |
maxRowsChanged(Statement stmt)
Has the maxRows value changed? |
java.lang.String |
nativeSQL(java.lang.String sql)
A driver may convert the JDBC sql grammar into its system's native SQL grammar prior to sending it; nativeSQL returns the native form of the statement that the driver would have sent. |
boolean |
parserKnowsUnicode()
DOCUMENT ME! |
private void |
ping()
Detect if the connection is still good |
private void |
pingAndReconnect(boolean ignoreAutoCommitSetting)
|
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)
This method creates a new CallableStatement for the
specified SQL string. |
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)
This method creates a new PreparedStatement for the specified
SQL string. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
java.lang.String[] autoGenKeyColNames)
|
protected void |
realClose(boolean calledExplicitly,
boolean issueRollback)
Closes connection and frees resources. |
void |
releaseSavepoint(java.sql.Savepoint arg0)
Removes the specified savepoint from this Connection. |
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 arg0)
Undoes all changes made after the specified savepoint was set. |
private void |
rollbackNoChecks()
|
void |
setAutoCommit(boolean autoCommit)
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. |
private void |
setFailedOverState()
Sets state for a failed-over connection |
void |
setHoldability(int arg0)
Sets the default holdability of ResultSetS that are created
from StatementS using this Connection. |
void |
setProfileSql(boolean flag)
Should the driver do profiling? |
(package private) void |
setReadInfoMsgEnabled(boolean flag)
|
void |
setReadOnly(boolean readOnly)
You can put a connection in read-only mode as a hint to enable database optimizations Note: setReadOnly cannot be called while in the middle of a transaction |
java.sql.Savepoint |
setSavepoint()
Creates a new unnamed savepoint for this Connection |
java.sql.Savepoint |
setSavepoint(java.lang.String arg0)
Creates a new savepoint with the specifiend name for this Connection. |
void |
setTransactionIsolation(int level)
DOCUMENT ME! |
void |
setTypeMap(java.util.Map map)
JDBC 2.0 Install a type-map object as the default type-map for this connection |
(package private) void |
setUseSSL(boolean flag)
Set whether or not this connection should use SSL |
private boolean |
shouldFallBack()
Should we try to connect back to the master? We try when we've been failed over >= this.secondsBeforeRetryMaster _or_ we've issued > this.queriesIssuedFailedOver |
void |
shutdownServer()
Used by MiniAdmin to shutdown a MySQL server |
boolean |
supportsIsolationLevel()
DOCUMENT ME! |
boolean |
supportsQuotedIdentifiers()
DOCUMENT ME! |
boolean |
supportsTransactions()
DOCUMENT ME! |
(package private) void |
unsetMaxRows(Statement stmt)
Called by statements on their .close() to let the connection know when it is safe to set the connection back to 'default' row limits. |
(package private) boolean |
useAnsiQuotedIdentifiers()
|
boolean |
useCompression()
Should we use compression? |
(package private) boolean |
useHostsInPrivileges()
|
(package private) boolean |
useMaxRows()
Has maxRows() been set? |
boolean |
useParanoidErrorMessages()
Returns the paranoidErrorMessages. |
boolean |
useSSL()
Should we use SSL? |
(package private) boolean |
useStreamLengthsInPrepStmts()
|
boolean |
useStrictFloatingPoint()
Should we enable work-arounds for floating point rounding errors in the server? |
boolean |
useStrictUpdates()
Returns the strictUpdates value. |
boolean |
useTimezone()
DOCUMENT ME! |
boolean |
useUnicode()
Should unicode character mapping be used ? |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
PING_COMMAND
private static final java.lang.String PING_COMMAND
- See Also:
- Constant Field Values
mapTransIsolationName2Value
private static java.util.Map mapTransIsolationName2Value
- Map mysql transaction isolation level name to
java.sql.Connection.TRANSACTION_XXX
charsetMap
private static java.util.Map charsetMap
- The mapping between MySQL charset names and Java charset names.
Initialized by loadCharacterSetMapping()
multibyteCharsetsMap
private static java.util.Map multibyteCharsetsMap
- Table of multi-byte charsets. Initialized by loadCharacterSetMapping()
DEFAULT_SOCKET_FACTORY
private static final java.lang.String DEFAULT_SOCKET_FACTORY
- Default socket factory classname
CHARSET_CONVERTER_NOT_AVAILABLE_MARKER
private static final java.lang.Object CHARSET_CONVERTER_NOT_AVAILABLE_MARKER
- Marker for character set converter not being available (not written,
multibyte, etc) Used to prevent multiple instantiation requests.
parserKnowsUnicode
boolean parserKnowsUnicode
dbmd
private DatabaseMetaData dbmd
- Internal DBMD to use for various database-version specific features
hostList
private java.util.List hostList
- The list of host(s) to try and connect to
cachedPreparedStatementParams
private java.util.Map cachedPreparedStatementParams
- A map of SQL to parsed prepared statement parameters.
charsetConverterMap
private java.util.Map charsetConverterMap
- Holds cached mappings to charset converters to avoid static
synchronization and at the same time save memory (each charset
converter takes approx 65K of static data).
statementsUsingMaxRows
private java.util.Map statementsUsingMaxRows
- A map of statements that have had setMaxRows() called on them
typeMap
private java.util.Map typeMap
- The type map for UDTs (not implemented, but used by some third-party
vendors, most notably IBM WebSphere)
io
private MysqlIO io
- The I/O abstraction interface (network conn to MySQL server
mutex
private final java.lang.Object mutex
- Mutex
serverVariables
private java.util.Map serverVariables
- The map of server variables that we retrieve at connection init.
myDriver
private NonRegisteringDriver myDriver
- The driver instance that created us
props
private java.util.Properties props
- Properties for this connection specified by user
database
private java.lang.String database
- The database we're currently using (called Catalog in JDBC terms).
encoding
private java.lang.String encoding
- If we're doing unicode character conversions, what encoding do we use?
host
private java.lang.String host
- The hostname we're connected to
myURL
private java.lang.String myURL
- The JDBC URL we're using
mysqlEncodingName
private java.lang.String mysqlEncodingName
- What does MySQL call this encoding?
negativeInfinityRep
private java.lang.String negativeInfinityRep
notANumberRep
private java.lang.String notANumberRep
password
private java.lang.String password
- The password we used
positiveInfinityRep
private java.lang.String positiveInfinityRep
socketFactoryClassName
private java.lang.String socketFactoryClassName
- Classname for socket factory
user
private java.lang.String user
- The user we're connected as
explicitCloseLocation
private java.lang.Throwable explicitCloseLocation
- Where was the connection _explicitly_ closed by the application?
forcedCloseReason
private java.lang.Throwable forcedCloseReason
- If the connection was forced closed, why was it forced closed?
defaultTimeZone
private java.util.TimeZone defaultTimeZone
serverTimezone
private java.util.TimeZone serverTimezone
- The timezone of the server
indexToCharsetMapping
private java.lang.String[] indexToCharsetMapping
- We need this 'bootstrapped', because 4.1 and newer will send fields back
with this even before we fill this dynamically from the server.
allowLoadLocalInfile
private boolean allowLoadLocalInfile
- Allow LOAD LOCAL INFILE (defaults to true)
alwaysClearStream
private boolean alwaysClearStream
- Should we clear the input stream each query?
autoCommit
private boolean autoCommit
- Are we in autoCommit mode?
cachePreparedStatements
private boolean cachePreparedStatements
- SHould we cache the parsing of prepared statements?
capitalizeDBMDTypes
private boolean capitalizeDBMDTypes
- Should we capitalize mysql types
clobberStreamingResults
private boolean clobberStreamingResults
- Should we clobber streaming results on new queries, or issue an error?
continueBatchOnError
private boolean continueBatchOnError
- Should we continue processing batch commands if one fails. The JDBC spec
allows either way, so we let the user choose
doUnicode
private boolean doUnicode
- Should we do unicode character conversions?
failOverReadOnly
private boolean failOverReadOnly
- When failed-over, set connection to read-only?
failedOver
private boolean failedOver
- Are we failed-over to a non-master host
hasIsolationLevels
private boolean hasIsolationLevels
- Does the server suuport isolation levels?
hasQuotedIdentifiers
private boolean hasQuotedIdentifiers
- Does this version of MySQL support quoted identifiers?
highAvailability
private boolean highAvailability
ignoreNonTxTables
private boolean ignoreNonTxTables
- Ignore non-transactional table warning for rollback?
isClosed
private boolean isClosed
- Has this connection been closed?
isInteractiveClient
private boolean isInteractiveClient
- Should we tell MySQL that we're an interactive client?
lowerCaseTableNames
private boolean lowerCaseTableNames
- Is the server configured to use lower-case table names only?
maxRowsChanged
private boolean maxRowsChanged
- Has the max-rows setting been changed from the default?
needsPing
private boolean needsPing
negativeInfinityRepIsClipped
private boolean negativeInfinityRepIsClipped
notANumberRepIsClipped
private boolean notANumberRepIsClipped
paranoid
private boolean paranoid
- Do we expose sensitive information in exception and error messages?
pedantic
private boolean pedantic
- Should we do 'extra' sanity checks?
positiveInfinityRepIsClipped
private boolean positiveInfinityRepIsClipped
readInfoMsg
private boolean readInfoMsg
- Should we retrieve 'info' messages from the server?
readOnly
private boolean readOnly
- Are we in read-only mode?
reconnectAtTxEnd
private boolean reconnectAtTxEnd
- If autoReconnect == true, should we attempt to reconnect at transaction
boundaries?
relaxAutoCommit
private boolean relaxAutoCommit
- Do we relax the autoCommit semantics? (For enhydra, for example)
strictFloatingPoint
private boolean strictFloatingPoint
- Do we need to correct endpoint rounding errors
strictUpdates
private boolean strictUpdates
- Do we check all keys for updatable result sets?
transactionsSupported
private boolean transactionsSupported
- Are transactions supported by the MySQL server we are connected to?
useAnsiQuotes
private boolean useAnsiQuotes
- Has ANSI_QUOTES been enabled on the server?
useCompression
private boolean useCompression
- Should we use compression?
useFastPing
private boolean useFastPing
- Can we use the "ping" command rather than a query?
useHostsInPrivileges
private boolean useHostsInPrivileges
- Should we tack on hostname in DBMD.getTable/ColumnPrivileges()?
useOnlyServerErrorMessages
private boolean useOnlyServerErrorMessages
- Should we only use the error message from the server when reporting
errors?
useSSL
private boolean useSSL
- Should we use SSL?
useStreamLengthsInPrepStmts
private boolean useStreamLengthsInPrepStmts
- Should we use stream lengths in prepared statements? (true by default ==
JDBC compliant)
useTimezone
private boolean useTimezone
- Should we use timezone information?
useUltraDevWorkAround
private boolean useUltraDevWorkAround
- Should we return PreparedStatements for UltraDev's stupid bug?
useUnbufferedInput
private boolean useUnbufferedInput
initialTimeout
private double initialTimeout
hostListSize
private int hostListSize
- How many hosts are in the host list?
isolationLevel
private int isolationLevel
- isolation level
maxAllowedPacket
private int maxAllowedPacket
- The largest packet we can send (changed once we know what the server
supports, we get this at connection init).
maxReconnects
private int maxReconnects
maxRows
private int maxRows
- The max rows that a result set can contain. Defaults to -1, which
according to the JDBC spec means "all".
netBufferLength
private int netBufferLength
port
private int port
- The port number we're connected to (defaults to 3306)
preparedStatementCacheMaxSqlSize
private int preparedStatementCacheMaxSqlSize
- If prepared statement caching is enabled, what should the threshold
length of the SQL to prepare should be in order to _not_ cache?
preparedStatementCacheSize
private int preparedStatementCacheSize
- If prepared statement caching is enabled, how many should we cache?
queriesBeforeRetryMaster
private int queriesBeforeRetryMaster
- How many queries should we wait before we try to re-connect to the
master, when we are failing over to replicated hosts Defaults to 50
socketTimeout
private int socketTimeout
- What should we set the socket timeout to?
lastQueryFinishedTime
private long lastQueryFinishedTime
- When did the last query finish?
masterFailTimeMillis
private long masterFailTimeMillis
- When did the master fail?
queriesIssuedFailedOver
private long queriesIssuedFailedOver
- Number of queries we've issued since the master failed
secondsBeforeRetryMaster
private long secondsBeforeRetryMaster
- How many seconds should we wait before retrying to connect to the master
if failed over? We fall back when either queriesBeforeRetryMaster or
secondsBeforeRetryMaster is reached.
characterSetResults
private java.lang.String characterSetResults
- The character set we want results and result metadata
returned in (null == results in any charset, metadata
in UTF-8).
characterSetResultsOnServer
private java.lang.String characterSetResultsOnServer
- The character set we want results and result metadata
returned in (null == results in any charset, metadata
in UTF-8).
characterSetMetadata
private java.lang.String characterSetMetadata
- For servers > 4.1.0, what character set is the metadata
returned in?
rollbackOnPooledClose
private boolean rollbackOnPooledClose
- Should rollback() be called when pooled connections are closed?
tinyint1isBit
private boolean tinyint1isBit
| Constructor Detail |
Connection
Connection(java.lang.String host, int port, java.util.Properties info, java.lang.String database, java.lang.String url, NonRegisteringDriver d) throws java.sql.SQLException
- Creates a connection to a MySQL Server.
| Method Detail |
setAutoCommit
public void setAutoCommit(boolean autoCommit)
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
JAVADOC
com.mysql.jdbc.Connection