Package com.mysql.cj.jdbc
Interface JdbcConnection
- All Superinterfaces:
java.lang.AutoCloseable
,java.sql.Connection
,MysqlConnection
,TransactionEventHandler
,java.sql.Wrapper
- All Known Subinterfaces:
LoadBalancedConnection
,ReplicationConnection
- All Known Implementing Classes:
ConnectionImpl
,ConnectionWrapper
,LoadBalancedMySQLConnection
,MultiHostMySQLConnection
,ReplicationMySQLConnection
public interface JdbcConnection extends java.sql.Connection, MysqlConnection, TransactionEventHandler
This interface contains methods that are considered the "vendor extension" to the JDBC API for MySQL's implementation of java.sql.Connection.
For those looking further into the driver implementation, it is not an API that is used for plugability of implementations inside our driver
(which is why there are still references to ConnectionImpl throughout the code).
-
Field Summary
-
Method Summary
Modifier and Type Method Description void
abortInternal()
Clobbers the physical network connection and marks this connection as closed.void
changeUser(java.lang.String userName, java.lang.String newPassword)
Changes the user on this connection by performing a re-authentication.void
clearHasTriedMaster()
Deprecated.java.sql.PreparedStatement
clientPrepareStatement(java.lang.String sql)
Prepares a statement on the client, using client-side emulation (irregardless of the configuration property 'useServerPrepStmts') with the same semantics as the java.sql.Connection.prepareStatement() method with the same argument types.java.sql.PreparedStatement
clientPrepareStatement(java.lang.String sql, int autoGenKeyIndex)
Prepares a statement on the client, using client-side emulation (irregardless of the configuration property 'useServerPrepStmts') with the same semantics as the java.sql.Connection.prepareStatement() method with the same argument types.java.sql.PreparedStatement
clientPrepareStatement(java.lang.String sql, int[] autoGenKeyIndexes)
Prepares a statement on the client, using client-side emulation (irregardless of the configuration property 'useServerPrepStmts') with the same semantics as the java.sql.Connection.prepareStatement() method with the same argument types.java.sql.PreparedStatement
clientPrepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency)
Prepares a statement on the client, using client-side emulation (irregardless of the configuration property 'useServerPrepStmts') with the same semantics as the java.sql.Connection.prepareStatement() method with the same argument types.java.sql.PreparedStatement
clientPrepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
Prepares a statement on the client, using client-side emulation (irregardless of the configuration property 'useServerPrepStmts') with the same semantics as the java.sql.Connection.prepareStatement() method with the same argument types.java.sql.PreparedStatement
clientPrepareStatement(java.lang.String sql, java.lang.String[] autoGenKeyColNames)
Prepares a statement on the client, using client-side emulation (irregardless of the configuration property 'useServerPrepStmts') with the same semantics as the java.sql.Connection.prepareStatement() method with the same argument types.void
decachePreparedStatement(JdbcPreparedStatement pstmt)
JdbcConnection
getActiveMySQLConnection()
int
getActiveStatementCount()
Returns the number of statements active on this connection, which haven't been .close()d.int
getAutoIncrementIncrement()
Returns the -session- value of 'auto_increment_increment' from the server if it exists, or '1' if not.CachedResultSetMetaData
getCachedMetaData(java.lang.String sql)
Returns cached metadata (or null if not cached) for the given query, which must match _exactly_.java.lang.String
getCharacterSetMetadata()
ClientInfoProvider
getClientInfoProviderImpl()
java.lang.String
getDatabase()
Retrieves this connection object's current database name.java.lang.String
getHost()
java.lang.String
getHostPortPair()
long
getIdleFor()
Reports how long this connection has been idle.java.sql.Statement
getMetadataSafeStatement()
JdbcConnection
getMultiHostParentProxy()
JdbcConnection
getMultiHostSafeProxy()
JdbcPropertySet
getPropertySet()
java.util.List<QueryInterceptor>
getQueryInterceptorsInstances()
ServerVersion
getServerVersion()
int
getSessionMaxRows()
Returns the sql select limit max-rows for this session.java.lang.String
getStatementComment()
Returns the comment that will be prepended to all statements sent to the server.boolean
hasSameProperties(JdbcConnection c)
Does this connection have the same properties as another?boolean
hasTriedMaster()
Deprecated.void
initializeResultsMetadataFromCache(java.lang.String sql, CachedResultSetMetaData cachedMetaData, ResultSetInternalMethods resultSet)
Caches CachedResultSetMetaData that has been placed in the cache using the given SQL as a key.void
initializeSafeQueryInterceptors()
boolean
isInGlobalTx()
Is this connection currently a participant in an XA transaction?default boolean
isMasterConnection()
Deprecated.boolean
isProxySet()
boolean
isReadOnly(boolean useSessionStatus)
Tests to see if the connection is in Read Only Mode.boolean
isSameResource(JdbcConnection c)
Does this connection have the same resource name as the given connection (for XA)?boolean
isServerLocal()
Is the server this connection is connected to "local" (i.e.boolean
isSourceConnection()
Is this connection connected to the first host in the list if there is a list of servers in the URL?boolean
lowerCaseTableNames()
Is the server configured to use lower-case table names only?void
ping()
Detect if the connection is still good by sending a ping command to the server.void
pingInternal(boolean checkForClosedConnection, int timeoutMillis)
void
realClose(boolean calledExplicitly, boolean issueRollback, boolean skipLocalTeardown, java.lang.Throwable reason)
Closes connection and frees resources.void
recachePreparedStatement(JdbcPreparedStatement pstmt)
void
registerStatement(JdbcStatement stmt)
Register a Statement instance as open.void
resetServerState()
Resets the server-side state of this connection.java.sql.PreparedStatement
serverPrepareStatement(java.lang.String sql)
Prepares a statement on the server (irregardless of the configuration property 'useServerPrepStmts') with the same semantics as the java.sql.Connection.prepareStatement() method with the same argument types.java.sql.PreparedStatement
serverPrepareStatement(java.lang.String sql, int autoGenKeyIndex)
Prepares a statement on the server (irregardless of the configuration property 'useServerPrepStmts') with the same semantics as the java.sql.Connection.prepareStatement() method with the same argument types.java.sql.PreparedStatement
serverPrepareStatement(java.lang.String sql, int[] autoGenKeyIndexes)
Prepares a statement on the server (irregardless of the configuration property 'useServerPrepStmts') with the same semantics as the java.sql.Connection.prepareStatement() method with the same argument types.java.sql.PreparedStatement
serverPrepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency)
Prepares a statement on the server (irregardless of the configuration property 'useServerPrepStmts') with the same semantics as the java.sql.Connection.prepareStatement() method with the same argument types.java.sql.PreparedStatement
serverPrepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
Prepares a statement on the server (irregardless of the configuration property 'useServerPrepStmts') with the same semantics as the java.sql.Connection.prepareStatement() method with the same argument types.java.sql.PreparedStatement
serverPrepareStatement(java.lang.String sql, java.lang.String[] autoGenKeyColNames)
Prepares a statement on the server (irregardless of the configuration property 'useServerPrepStmts') with the same semantics as the java.sql.Connection.prepareStatement() method with the same argument types.void
setDatabase(java.lang.String dbName)
Set current database for this connection.void
setFailedOver(boolean flag)
void
setInGlobalTx(boolean flag)
Set the state of being in a global (XA) transaction.void
setProxy(JdbcConnection proxy)
void
setReadOnlyInternal(boolean readOnlyFlag)
void
setSessionMaxRows(int max)
Sets the sql select limit max-rows for this session if different from current.void
setStatementComment(java.lang.String comment)
Sets the comment that will be prepended to all statements sent to the server.void
shutdownServer()
Used by MiniAdmin to shutdown a MySQL serverboolean
storesLowerCaseTableName()
void
throwConnectionClosedException()
void
unregisterStatement(JdbcStatement stmt)
Remove the given statement from the list of open statementsvoid
unSafeQueryInterceptors()
Methods inherited from interface java.sql.Connection
abort, beginRequest, clearWarnings, close, commit, createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStatement, createStatement, createStatement, createStruct, endRequest, getAutoCommit, getCatalog, getClientInfo, getClientInfo, getHoldability, getMetaData, getNetworkTimeout, getSchema, getTransactionIsolation, getTypeMap, getWarnings, isClosed, isReadOnly, isValid, nativeSQL, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, rollback, setAutoCommit, setCatalog, setClientInfo, setClientInfo, setHoldability, setNetworkTimeout, setReadOnly, setSavepoint, setSavepoint, setSchema, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid, setTransactionIsolation, setTypeMap
Methods inherited from interface com.mysql.cj.MysqlConnection
checkClosed, cleanup, createNewIO, getConnectionMutex, getExceptionInterceptor, getId, getProperties, getSession, getURL, getUser, normalClose
Methods inherited from interface com.mysql.cj.TransactionEventHandler
transactionBegun, transactionCompleted
-
Method Details
-
getPropertySet
JdbcPropertySet getPropertySet()- Specified by:
getPropertySet
in interfaceMysqlConnection
-
changeUser
void changeUser(java.lang.String userName, java.lang.String newPassword) throws java.sql.SQLExceptionChanges the user on this connection by performing a re-authentication. If authentication fails, the connection is failed.- Parameters:
userName
- the username to authenticate withnewPassword
- the password to authenticate with- Throws:
java.sql.SQLException
- if authentication fails, or some other error occurs while performing the command.
-
clearHasTriedMaster
@Deprecated void clearHasTriedMaster()Deprecated. -
clientPrepareStatement
java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql) throws java.sql.SQLExceptionPrepares 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.- Parameters:
sql
- statement- Returns:
- prepared statement
- Throws:
java.sql.SQLException
- if an error occurs- See Also:
Connection.prepareStatement(String)
-
clientPrepareStatement
java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql, int autoGenKeyIndex) throws java.sql.SQLExceptionPrepares 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.- Parameters:
sql
- statementautoGenKeyIndex
- autoGenKeyIndex- Returns:
- prepared statement
- Throws:
java.sql.SQLException
- if an error occurs- See Also:
Connection.prepareStatement(String, int)
-
clientPrepareStatement
java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLExceptionPrepares 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.- Parameters:
sql
- statementresultSetType
- resultSetTyperesultSetConcurrency
- resultSetConcurrency- Returns:
- prepared statement
- Throws:
java.sql.SQLException
- if an error occurs- See Also:
Connection.prepareStatement(String, int, int)
-
clientPrepareStatement
java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql, int[] autoGenKeyIndexes) throws java.sql.SQLExceptionPrepares 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.- Parameters:
sql
- statementautoGenKeyIndexes
- autoGenKeyIndexes- Returns:
- prepared statement
- Throws:
java.sql.SQLException
- if an error occurs- See Also:
Connection.prepareStatement(String, int[])
-
clientPrepareStatement
java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLExceptionPrepares 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.- Parameters:
sql
- statementresultSetType
- resultSetTyperesultSetConcurrency
- resultSetConcurrencyresultSetHoldability
- resultSetHoldability- Returns:
- prepared statement
- Throws:
java.sql.SQLException
- if an error occurs- See Also:
Connection.prepareStatement(String, int, int, int)
-
clientPrepareStatement
java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql, java.lang.String[] autoGenKeyColNames) throws java.sql.SQLExceptionPrepares 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.- Parameters:
sql
- statementautoGenKeyColNames
- autoGenKeyColNames- Returns:
- prepared statement
- Throws:
java.sql.SQLException
- if an error occurs- See Also:
Connection.prepareStatement(String, String[])
-
getActiveStatementCount
int getActiveStatementCount()Returns the number of statements active on this connection, which haven't been .close()d.- Returns:
- the number of active statements
-
getIdleFor
long getIdleFor()Reports how long this connection has been idle. This time (reported in milliseconds) is updated once a query has completed.- Returns:
- number of ms that this connection has been idle, 0 if the driver is busy retrieving results.
-
getStatementComment
java.lang.String getStatementComment()Returns the comment that will be prepended to all statements sent to the server.- Returns:
- the comment that will be prepended to all statements sent to the server.
-
hasTriedMaster
@Deprecated boolean hasTriedMaster()Deprecated.Has this connection tried to execute a query on the "source" server (first host in a multiple host list).- Returns:
- true if it has tried
-
isInGlobalTx
boolean isInGlobalTx()Is this connection currently a participant in an XA transaction?- Returns:
- true if this connection currently a participant in an XA transaction
-
setInGlobalTx
void setInGlobalTx(boolean flag)Set the state of being in a global (XA) transaction.- Parameters:
flag
- the state flag
-
isSourceConnection
boolean isSourceConnection()Is this connection connected to the first host in the list if there is a list of servers in the URL?- Returns:
- true if this connection is connected to the first in the list.
-
isMasterConnection
@Deprecated default boolean isMasterConnection()Deprecated.UseisSourceConnection()
instead.- Returns:
- true if it's a source connection
-
isSameResource
Does this connection have the same resource name as the given connection (for XA)?- Parameters:
c
- connection- Returns:
- true if it is the same one
-
lowerCaseTableNames
boolean lowerCaseTableNames()Is the server configured to use lower-case table names only?- Returns:
- true if lower_case_table_names is 'on'
-
ping
void ping() throws java.sql.SQLExceptionDetect if the connection is still good by sending a ping command to the server.- Throws:
java.sql.SQLException
- if the ping fails
-
resetServerState
void resetServerState() throws java.sql.SQLExceptionResets the server-side state of this connection. Doesn't work if isParanoid() is set (it will become a no-op in this case). Usually only used from connection pooling code.- Throws:
java.sql.SQLException
- if the operation fails while resetting server state.
-
serverPrepareStatement
java.sql.PreparedStatement serverPrepareStatement(java.lang.String sql) throws java.sql.SQLExceptionPrepares 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.- Parameters:
sql
- statement- Returns:
- prepared statement
- Throws:
java.sql.SQLException
- if an error occurs- See Also:
Connection.prepareStatement(String)
-
serverPrepareStatement
java.sql.PreparedStatement serverPrepareStatement(java.lang.String sql, int autoGenKeyIndex) throws java.sql.SQLExceptionPrepares 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.- Parameters:
sql
- statementautoGenKeyIndex
- autoGenKeyIndex- Returns:
- prepared statement
- Throws:
java.sql.SQLException
- if an error occurs- See Also:
Connection.prepareStatement(String, int)
-
serverPrepareStatement
java.sql.PreparedStatement serverPrepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLExceptionPrepares 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.- Parameters:
sql
- statementresultSetType
- resultSetTyperesultSetConcurrency
- resultSetConcurrency- Returns:
- prepared statement
- Throws:
java.sql.SQLException
- if an error occurs- See Also:
Connection.prepareStatement(String, int, int)
-
serverPrepareStatement
java.sql.PreparedStatement serverPrepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLExceptionPrepares 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.- Parameters:
sql
- statementresultSetType
- resultSetTyperesultSetConcurrency
- resultSetConcurrencyresultSetHoldability
- resultSetHoldability- Returns:
- prepared statement
- Throws:
java.sql.SQLException
- if an error occurs- See Also:
Connection.prepareStatement(String, int, int, int)
-
serverPrepareStatement
java.sql.PreparedStatement serverPrepareStatement(java.lang.String sql, int[] autoGenKeyIndexes) throws java.sql.SQLExceptionPrepares 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.- Parameters:
sql
- statementautoGenKeyIndexes
- autoGenKeyIndexes- Returns:
- prepared statement
- Throws:
java.sql.SQLException
- if an error occurs- See Also:
Connection.prepareStatement(String, int[])
-
serverPrepareStatement
java.sql.PreparedStatement serverPrepareStatement(java.lang.String sql, java.lang.String[] autoGenKeyColNames) throws java.sql.SQLExceptionPrepares 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.- Parameters:
sql
- statementautoGenKeyColNames
- autoGenKeyColNames- Returns:
- prepared statement
- Throws:
java.sql.SQLException
- if an error occurs- See Also:
Connection.prepareStatement(String, String[])
-
setFailedOver
void setFailedOver(boolean flag)- Parameters:
flag
- The failedOver flag to set.
-
setStatementComment
void setStatementComment(java.lang.String comment)Sets the comment that will be prepended to all statements sent to the server. Do not use slash-star or star-slash tokens in the comment as these will be added by the driver itself.- Parameters:
comment
- the comment that will be prepended to all statements sent to the server.
-
shutdownServer
void shutdownServer() throws java.sql.SQLExceptionUsed by MiniAdmin to shutdown a MySQL server- Throws:
java.sql.SQLException
- if the command can not be issued.
-
getAutoIncrementIncrement
int getAutoIncrementIncrement()Returns the -session- value of 'auto_increment_increment' from the server if it exists, or '1' if not.- Returns:
- the -session- value of 'auto_increment_increment'
-
hasSameProperties
Does this connection have the same properties as another?- Parameters:
c
- connection- Returns:
- true if has the same properties
-
getHost
java.lang.String getHost() -
getHostPortPair
java.lang.String getHostPortPair() -
setProxy
-
isServerLocal
boolean isServerLocal() throws java.sql.SQLExceptionIs the server this connection is connected to "local" (i.e. same host) as the application?- Returns:
- true if the server is "local"
- Throws:
java.sql.SQLException
- if an error occurs
-
getSessionMaxRows
int getSessionMaxRows()Returns the sql select limit max-rows for this session.- Returns:
- int max rows
-
setSessionMaxRows
void setSessionMaxRows(int max) throws java.sql.SQLExceptionSets the sql select limit max-rows for this session if different from current.- Parameters:
max
- the new max-rows value to set.- Throws:
java.sql.SQLException
- if a database error occurs issuing the statement that sets the limit.
-
abortInternal
void abortInternal() throws java.sql.SQLExceptionClobbers the physical network connection and marks this connection as closed.- Throws:
java.sql.SQLException
- if an error occurs
-
isProxySet
boolean isProxySet() -
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.- 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.
-
getCharacterSetMetadata
java.lang.String getCharacterSetMetadata()- Returns:
- Returns the characterSetMetadata.
-
getMetadataSafeStatement
java.sql.Statement getMetadataSafeStatement() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getServerVersion
ServerVersion getServerVersion() -
getQueryInterceptorsInstances
java.util.List<QueryInterceptor> getQueryInterceptorsInstances() -
initializeResultsMetadataFromCache
void initializeResultsMetadataFromCache(java.lang.String sql, CachedResultSetMetaData cachedMetaData, ResultSetInternalMethods resultSet) throws java.sql.SQLExceptionCaches CachedResultSetMetaData that has been placed in the cache using the given SQL as a key. This method is synchronized by the caller on getMutex(), so if calling this method from internal code in the driver, make sure it's synchronized on the mutex that guards communication with the server.- Parameters:
sql
- the query that the metadata pertains too.cachedMetaData
- metadata (if it exists) to populate the cache.resultSet
- the result set to retreive metadata from, or apply to.- Throws:
java.sql.SQLException
- if an error occurs
-
initializeSafeQueryInterceptors
void initializeSafeQueryInterceptors() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
isReadOnly
boolean isReadOnly(boolean useSessionStatus) throws java.sql.SQLExceptionTests to see if the connection is in Read Only Mode.- Parameters:
useSessionStatus
- in some cases, for example when restoring connection with autoReconnect=true, we can rely only on saved readOnly state, so use useSessionStatus=false in that case- Returns:
- true if the connection is read only
- Throws:
java.sql.SQLException
- if a database access error occurs
-
pingInternal
void pingInternal(boolean checkForClosedConnection, int timeoutMillis) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
realClose
void realClose(boolean calledExplicitly, boolean issueRollback, boolean skipLocalTeardown, java.lang.Throwable reason) throws java.sql.SQLExceptionCloses connection and frees resources.- Parameters:
calledExplicitly
- is this being called from close()issueRollback
- should a rollback() be issued?skipLocalTeardown
- if true, driver tries to close connection normally, performing rollbacks, closing open statements etc; otherwise the force close is performedreason
- the exception caused this method call- Throws:
java.sql.SQLException
- if an error occurs
-
recachePreparedStatement
- Throws:
java.sql.SQLException
-
decachePreparedStatement
- Throws:
java.sql.SQLException
-
registerStatement
Register a Statement instance as open.- Parameters:
stmt
- the Statement instance to remove
-
setReadOnlyInternal
void setReadOnlyInternal(boolean readOnlyFlag) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
storesLowerCaseTableName
boolean storesLowerCaseTableName() -
throwConnectionClosedException
void throwConnectionClosedException() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
unregisterStatement
Remove the given statement from the list of open statements- Parameters:
stmt
- the Statement instance to remove
-
unSafeQueryInterceptors
void unSafeQueryInterceptors() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getMultiHostSafeProxy
JdbcConnection getMultiHostSafeProxy() -
getMultiHostParentProxy
JdbcConnection getMultiHostParentProxy() -
getActiveMySQLConnection
JdbcConnection getActiveMySQLConnection() -
getClientInfoProviderImpl
- Throws:
java.sql.SQLException
-
setDatabase
void setDatabase(java.lang.String dbName) throws java.sql.SQLExceptionSet current database for this connection.- Parameters:
dbName
- the database for this connection to use- Throws:
java.sql.SQLException
- if a database access error occurs
-
getDatabase
java.lang.String getDatabase() throws java.sql.SQLExceptionRetrieves this connection object's current database name.- Returns:
- current database name
- Throws:
java.sql.SQLException
- if an error occurs
-