Package org.mariadb.jdbc
Class Connection
- java.lang.Object
-
- org.mariadb.jdbc.Connection
-
- All Implemented Interfaces:
AutoCloseable,Connection,Wrapper
public class Connection extends Object implements Connection
-
-
Field Summary
-
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
-
-
Constructor Summary
Constructors Constructor Description Connection(Configuration conf, ReentrantLock lock, org.mariadb.jdbc.client.Client client)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabort(Executor executor)voidcancelCurrentQuery()Cancels the current query - clones the current protocol and executes a query using the new connection.voidclearWarnings()voidclose()voidcommit()ArraycreateArrayOf(String typeName, Object[] elements)BlobcreateBlob()ClobcreateClob()NClobcreateNClob()SQLXMLcreateSQLXML()StatementcreateStatement()StatementcreateStatement(int resultSetType, int resultSetConcurrency)StatementcreateStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)StructcreateStruct(String typeName, Object[] attributes)voidfireStatementClosed(PreparedStatement prep)booleangetAutoCommit()StringgetCatalog()org.mariadb.jdbc.client.ClientgetClient()PropertiesgetClientInfo()StringgetClientInfo(String name)ContextgetContext()protected ExceptionFactorygetExceptionFactory()intgetHoldability()intgetLowercaseTableNames()Are table case-sensitive or not .DatabaseMetaDatagetMetaData()intgetNetworkTimeout()StringgetSchema()longgetThreadId()intgetTransactionIsolation()Map<String,Class<?>>getTypeMap()intgetWaitTimeout()SQLWarninggetWarnings()booleanisClosed()booleanisReadOnly()booleanisValid(int timeout)booleanisWrapperFor(Class<?> iface)StringnativeSQL(String sql)CallableStatementprepareCall(String sql)CallableStatementprepareCall(String sql, int resultSetType, int resultSetConcurrency)CallableStatementprepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)PreparedStatementprepareInternal(String sql, int autoGeneratedKeys, int resultSetType, int resultSetConcurrency, boolean useBinary)PreparedStatementprepareStatement(String sql)PreparedStatementprepareStatement(String sql, int autoGeneratedKeys)PreparedStatementprepareStatement(String sql, int[] columnIndexes)PreparedStatementprepareStatement(String sql, int resultSetType, int resultSetConcurrency)PreparedStatementprepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)PreparedStatementprepareStatement(String sql, String[] columnNames)voidreleaseSavepoint(Savepoint savepoint)voidreset()Reset connection set has it was after creating a "fresh" new connection.voidrollback()voidrollback(Savepoint savepoint)voidsetAutoCommit(boolean autoCommit)voidsetCatalog(String catalog)voidsetClientInfo(String name, String value)voidsetClientInfo(Properties properties)voidsetHoldability(int holdability)voidsetNetworkTimeout(Executor executor, int milliseconds)voidsetPoolConnection(MariaDbPoolConnection poolConnection)voidsetReadOnly(boolean readOnly)org.mariadb.jdbc.Connection.SavepointsetSavepoint()org.mariadb.jdbc.Connection.SavepointsetSavepoint(String name)voidsetSchema(String schema)voidsetTransactionIsolation(int level)voidsetTypeMap(Map<String,Class<?>> map)<T> Tunwrap(Class<T> iface)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.sql.Connection
beginRequest, endRequest, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid
-
-
-
-
Constructor Detail
-
Connection
public Connection(Configuration conf, ReentrantLock lock, org.mariadb.jdbc.client.Client client)
-
-
Method Detail
-
setPoolConnection
public void setPoolConnection(MariaDbPoolConnection poolConnection)
-
cancelCurrentQuery
public void cancelCurrentQuery() throws SQLExceptionCancels the current query - clones the current protocol and executes a query using the new connection.- Throws:
SQLException- never thrown
-
createStatement
public Statement createStatement()
- Specified by:
createStatementin interfaceConnection
-
prepareStatement
public PreparedStatement prepareStatement(String sql) throws SQLException
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareInternal
public PreparedStatement prepareInternal(String sql, int autoGeneratedKeys, int resultSetType, int resultSetConcurrency, boolean useBinary) throws SQLException
- Throws:
SQLException
-
prepareCall
public CallableStatement prepareCall(String sql) throws SQLException
- Specified by:
prepareCallin interfaceConnection- Throws:
SQLException
-
nativeSQL
public String nativeSQL(String sql) throws SQLException
- Specified by:
nativeSQLin interfaceConnection- Throws:
SQLException
-
getAutoCommit
public boolean getAutoCommit()
- Specified by:
getAutoCommitin interfaceConnection
-
setAutoCommit
public void setAutoCommit(boolean autoCommit) throws SQLException- Specified by:
setAutoCommitin interfaceConnection- Throws:
SQLException
-
commit
public void commit() throws SQLException- Specified by:
commitin interfaceConnection- Throws:
SQLException
-
rollback
public void rollback() throws SQLException- Specified by:
rollbackin interfaceConnection- Throws:
SQLException
-
close
public void close() throws SQLException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceConnection- Throws:
SQLException
-
isClosed
public boolean isClosed()
- Specified by:
isClosedin interfaceConnection
-
getContext
public Context getContext()
-
getLowercaseTableNames
public int getLowercaseTableNames() throws SQLExceptionAre table case-sensitive or not . Default Value: 0 (Unix), 1 (Windows), 2 (Mac OS X). If set to 0 (the default on Unix-based systems), table names and aliases and database names are compared in a case-sensitive manner. If set to 1 (the default on Windows), names are stored in lowercase and not compared in a case-sensitive manner. If set to 2 (the default on Mac OS X), names are stored as declared, but compared in lowercase.- Returns:
- int value.
- Throws:
SQLException- if a connection error occur
-
getMetaData
public DatabaseMetaData getMetaData()
- Specified by:
getMetaDatain interfaceConnection
-
isReadOnly
public boolean isReadOnly()
- Specified by:
isReadOnlyin interfaceConnection
-
setReadOnly
public void setReadOnly(boolean readOnly) throws SQLException- Specified by:
setReadOnlyin interfaceConnection- Throws:
SQLException
-
getCatalog
public String getCatalog() throws SQLException
- Specified by:
getCatalogin interfaceConnection- Throws:
SQLException
-
setCatalog
public void setCatalog(String catalog) throws SQLException
- Specified by:
setCatalogin interfaceConnection- Throws:
SQLException
-
getTransactionIsolation
public int getTransactionIsolation() throws SQLException- Specified by:
getTransactionIsolationin interfaceConnection- Throws:
SQLException
-
setTransactionIsolation
public void setTransactionIsolation(int level) throws SQLException- Specified by:
setTransactionIsolationin interfaceConnection- Throws:
SQLException
-
getWarnings
public SQLWarning getWarnings() throws SQLException
- Specified by:
getWarningsin interfaceConnection- Throws:
SQLException
-
clearWarnings
public void clearWarnings()
- Specified by:
clearWarningsin interfaceConnection
-
createStatement
public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException
- Specified by:
createStatementin interfaceConnection- Throws:
SQLException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareCall
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
- Specified by:
prepareCallin interfaceConnection- Throws:
SQLException
-
getTypeMap
public Map<String,Class<?>> getTypeMap()
- Specified by:
getTypeMapin interfaceConnection
-
setTypeMap
public void setTypeMap(Map<String,Class<?>> map) throws SQLException
- Specified by:
setTypeMapin interfaceConnection- Throws:
SQLException
-
getHoldability
public int getHoldability()
- Specified by:
getHoldabilityin interfaceConnection
-
setHoldability
public void setHoldability(int holdability)
- Specified by:
setHoldabilityin interfaceConnection
-
setSavepoint
public org.mariadb.jdbc.Connection.Savepoint setSavepoint() throws SQLException- Specified by:
setSavepointin interfaceConnection- Throws:
SQLException
-
setSavepoint
public org.mariadb.jdbc.Connection.Savepoint setSavepoint(String name) throws SQLException
- Specified by:
setSavepointin interfaceConnection- Throws:
SQLException
-
rollback
public void rollback(Savepoint savepoint) throws SQLException
- Specified by:
rollbackin interfaceConnection- Throws:
SQLException
-
releaseSavepoint
public void releaseSavepoint(Savepoint savepoint) throws SQLException
- Specified by:
releaseSavepointin interfaceConnection- Throws:
SQLException
-
createStatement
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
- Specified by:
createStatementin interfaceConnection- Throws:
SQLException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareCall
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
- Specified by:
prepareCallin interfaceConnection- Throws:
SQLException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
createClob
public Clob createClob()
- Specified by:
createClobin interfaceConnection
-
createBlob
public Blob createBlob()
- Specified by:
createBlobin interfaceConnection
-
createNClob
public NClob createNClob()
- Specified by:
createNClobin interfaceConnection
-
createSQLXML
public SQLXML createSQLXML() throws SQLException
- Specified by:
createSQLXMLin interfaceConnection- Throws:
SQLException
-
isValid
public boolean isValid(int timeout) throws SQLException- Specified by:
isValidin interfaceConnection- Throws:
SQLException
-
setClientInfo
public void setClientInfo(String name, String value)
- Specified by:
setClientInfoin interfaceConnection
-
getClientInfo
public String getClientInfo(String name)
- Specified by:
getClientInfoin interfaceConnection
-
getClientInfo
public Properties getClientInfo()
- Specified by:
getClientInfoin interfaceConnection
-
setClientInfo
public void setClientInfo(Properties properties)
- Specified by:
setClientInfoin interfaceConnection
-
createArrayOf
public Array createArrayOf(String typeName, Object[] elements) throws SQLException
- Specified by:
createArrayOfin interfaceConnection- Throws:
SQLException
-
createStruct
public Struct createStruct(String typeName, Object[] attributes) throws SQLException
- Specified by:
createStructin interfaceConnection- Throws:
SQLException
-
getSchema
public String getSchema()
- Specified by:
getSchemain interfaceConnection
-
setSchema
public void setSchema(String schema)
- Specified by:
setSchemain interfaceConnection
-
abort
public void abort(Executor executor) throws SQLException
- Specified by:
abortin interfaceConnection- Throws:
SQLException
-
setNetworkTimeout
public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException
- Specified by:
setNetworkTimeoutin interfaceConnection- Throws:
SQLException
-
getNetworkTimeout
public int getNetworkTimeout()
- Specified by:
getNetworkTimeoutin interfaceConnection
-
unwrap
public <T> T unwrap(Class<T> iface) throws SQLException
- Specified by:
unwrapin interfaceWrapper- Throws:
SQLException
-
isWrapperFor
public boolean isWrapperFor(Class<?> iface)
- Specified by:
isWrapperForin interfaceWrapper
-
getWaitTimeout
public int getWaitTimeout()
-
getClient
public org.mariadb.jdbc.client.Client getClient()
-
reset
public void reset() throws SQLExceptionReset connection set has it was after creating a "fresh" new connection. defaultTransactionIsolation must have been initialized.BUT : - session variable state are reset only if option useResetConnection is set and - if using the option "useServerPrepStmts", PREPARE statement are still prepared
- Throws:
SQLException- if resetting operation failed
-
getThreadId
public long getThreadId()
-
fireStatementClosed
public void fireStatementClosed(PreparedStatement prep)
-
getExceptionFactory
protected ExceptionFactory getExceptionFactory()
-
-