Share via


IConnection Interface

Definition

A connection (session) with a specific database.

[Android.Runtime.Register("java/sql/Connection", "", "Java.Sql.IConnectionInvoker")]
public interface IConnection : IDisposable, Java.Interop.IJavaPeerable, Java.Sql.IWrapper
[<Android.Runtime.Register("java/sql/Connection", "", "Java.Sql.IConnectionInvoker")>]
type IConnection = interface
    interface IWrapper
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Attributes
Implements

Remarks

A connection (session) with a specific database. SQL statements are executed and results are returned within the context of a connection.

A Connection object's database is able to provide information describing its tables, its supported SQL grammar, its stored procedures, the capabilities of this connection, and so on. This information is obtained with the getMetaData method.

<B>Note:</B> When configuring a Connection, JDBC applications should use the appropriate Connection method such as setAutoCommit or setTransactionIsolation. Applications should not invoke SQL commands directly to change the connection's configuration when there is a JDBC method available. By default a Connection object is in auto-commit mode, which means that it automatically commits changes after executing each statement. If auto-commit mode has been disabled, the method commit must be called explicitly in order to commit changes; otherwise, database changes will not be saved.

A new Connection object created using the JDBC 2.1 core API has an initially empty type map associated with it. A user may enter a custom mapping for a UDT in this type map. When a UDT is retrieved from a data source with the method ResultSet.getObject, the getObject method will check the connection's type map to see if there is an entry for that UDT. If so, the getObject method will map the UDT to the class indicated. If there is no entry, the UDT will be mapped using the standard mapping.

A user may create a new type map, which is a java.util.Map object, make an entry in it, and pass it to the java.sql methods that can perform custom mapping. In this case, the method will use the given type map instead of the one associated with the connection.

For example, the following code fragment specifies that the SQL type ATHLETES will be mapped to the class Athletes in the Java programming language. The code fragment retrieves the type map for the Connection object con, inserts the entry into it, and then sets the type map with the new entry as the connection's type map.

java.util.Map map = con.getTypeMap();
                 map.put("mySchemaName.ATHLETES", Class.forName("Athletes"));
                 con.setTypeMap(map);

Java documentation for java.sql.Connection.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Fields

TransactionNone

A constant indicating that transactions are not supported.

TransactionReadCommitted

A constant indicating that dirty reads are prevented; non-repeatable reads and phantom reads can occur.

TransactionReadUncommitted

A constant indicating that dirty reads, non-repeatable reads and phantom reads can occur.

TransactionRepeatableRead

A constant indicating that dirty reads and non-repeatable reads are prevented; phantom reads can occur.

TransactionSerializable

A constant indicating that dirty reads, non-repeatable reads and phantom reads are prevented.

Properties

AutoCommit

Returns a boolean indicating whether or not this connection is in the auto-commit operating mode.

Catalog

Gets this Connection object's current catalog name.

ClientInfo

Returns a Properties object containing all client info properties.

Handle

Gets the JNI value of the underlying Android object.

(Inherited from IJavaObject)
Holdability

Returns the holdability property that any ResultSet produced by this instance will have.

IsClosed

Returns a boolean indicating whether or not this connection is in the closed state.

JniIdentityHashCode

Returns the value of java.lang.System.identityHashCode() for the wrapped instance.

(Inherited from IJavaPeerable)
JniManagedPeerState

State of the managed peer.

(Inherited from IJavaPeerable)
JniPeerMembers

Member access and invocation support.

(Inherited from IJavaPeerable)
MetaData

Gets the metadata about the database referenced by this connection.

PeerReference

Returns a JniObjectReference of the wrapped Java object instance.

(Inherited from IJavaPeerable)
ReadOnly

Returns a boolean indicating whether or not this connection is currently in the read-only state.

TransactionIsolation

Returns the transaction isolation level for this connection.

TypeMap

Returns the type mapping associated with this Connection object.

Warnings

Gets the first instance of any SQLWarning objects that may have been created in the use of this connection.

Methods

ClearWarnings()

Clears all warnings reported for this Connection object.

Close()

Releases this Connection object's database and JDBC resources immediately instead of waiting for them to be automatically released.

Commit()

Makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by this Connection object.

CreateArrayOf(String, Object[])

Factory method for creating Array objects.

CreateBlob()

Constructs an object that implements the Blob interface.

CreateClob()

Constructs an object that implements the Clob interface.

CreateNClob()

Constructs an object that implements the NClob interface.

CreateSQLXML()

Constructs an object that implements the SQLXML interface.

CreateStatement()

Creates a Statement object for sending SQL statements to the database.

CreateStatement(Int32, Int32, Int32)

Creates a Statement object that will generate ResultSet objects with the given type, concurrency, and holdability.

CreateStatement(Int32, Int32)

Creates a Statement object that will generate ResultSet objects with the given type and concurrency.

CreateStruct(String, Object[])

Factory method for creating Struct objects.

Disposed()

Called when the instance has been disposed.

(Inherited from IJavaPeerable)
DisposeUnlessReferenced()

If there are no outstanding references to this instance, then calls Dispose(); otherwise, does nothing.

(Inherited from IJavaPeerable)
Finalized()

Called when the instance has been finalized.

(Inherited from IJavaPeerable)
GetClientInfo(String)

Returns the value of the client info property specified by name.

IsValid(Int32)

Returns true if the connection has not been closed and is still valid.

IsWrapperFor(Class)

Returns true if this either implements the interface argument or is directly or indirectly a wrapper for an object that does.

(Inherited from IWrapper)
NativeSQL(String)

Converts the given SQL statement into the system's native SQL grammar.

PrepareCall(String, Int32, Int32, Int32)

Creates a CallableStatement object that will generate ResultSet objects with the given type and concurrency.

PrepareCall(String, Int32, Int32)

Creates a CallableStatement object that will generate ResultSet objects with the given type and concurrency.

PrepareCall(String)

Creates a CallableStatement object for calling database stored procedures.

PrepareStatement(String, Int32, Int32, Int32)

Creates a PreparedStatement object that will generate ResultSet objects with the given type, concurrency, and holdability.

PrepareStatement(String, Int32, Int32)

Creates a PreparedStatement object that will generate ResultSet objects with the given type and concurrency.

PrepareStatement(String, Int32)

Creates a default PreparedStatement object that has the capability to retrieve auto-generated keys.

PrepareStatement(String, Int32[])

Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array.

PrepareStatement(String, String[])

Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array.

PrepareStatement(String)

Creates a PreparedStatement object for sending parameterized SQL statements to the database.

ReleaseSavepoint(ISavepoint)

Removes the specified Savepoint and subsequent Savepoint objects from the current transaction.

Rollback()

Undoes all changes made in the current transaction and releases any database locks currently held by this Connection object.

Rollback(ISavepoint)

Undoes all changes made after the given Savepoint object was set.

SetClientInfo(String, String)

Sets the value of the client info property specified by name to the value specified by value.

SetJniIdentityHashCode(Int32)

Set the value returned by JniIdentityHashCode.

(Inherited from IJavaPeerable)
SetJniManagedPeerState(JniManagedPeerStates) (Inherited from IJavaPeerable)
SetPeerReference(JniObjectReference)

Set the value returned by PeerReference.

(Inherited from IJavaPeerable)
SetSavepoint()

Creates an unnamed savepoint in the current transaction and returns the new Savepoint object that represents it.

SetSavepoint(String)

Creates a savepoint with the given name in the current transaction and returns the new Savepoint object that represents it.

UnregisterFromRuntime()

Unregister this instance so that the runtime will not return it from future Java.Interop.JniRuntime+JniValueManager.PeekValue invocations.

(Inherited from IJavaPeerable)
Unwrap(Class)

Returns an object that implements the given interface to allow access to non-standard methods, or standard methods not exposed by the proxy.

(Inherited from IWrapper)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to