IConnection Interface
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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 |
Catalog |
Gets this |
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 |
IsClosed |
Returns a |
JniIdentityHashCode |
Returns the value of |
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 |
TransactionIsolation |
Returns the transaction isolation level for this connection. |
TypeMap |
Returns the type mapping associated with this |
Warnings |
Gets the first instance of any |
Methods
ClearWarnings() |
Clears all warnings reported for this |
Close() |
Releases this |
Commit() |
Makes all changes made since the previous
commit/rollback permanent and releases any database locks
currently held by this |
CreateArrayOf(String, Object[]) |
Factory method for creating Array objects. |
CreateBlob() |
Constructs an object that implements the |
CreateClob() |
Constructs an object that implements the |
CreateNClob() |
Constructs an object that implements the |
CreateSQLXML() |
Constructs an object that implements the |
CreateStatement() |
Creates a |
CreateStatement(Int32, Int32, Int32) |
Creates a |
CreateStatement(Int32, Int32) |
Creates a |
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 |
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 |
PrepareCall(String, Int32, Int32) |
Creates a |
PrepareCall(String) |
Creates a |
PrepareStatement(String, Int32, Int32, Int32) |
Creates a |
PrepareStatement(String, Int32, Int32) |
Creates a |
PrepareStatement(String, Int32) |
Creates a default |
PrepareStatement(String, Int32[]) |
Creates a default |
PrepareStatement(String, String[]) |
Creates a default |
PrepareStatement(String) |
Creates a |
ReleaseSavepoint(ISavepoint) |
Removes the specified |
Rollback() |
Undoes all changes made in the current transaction
and releases any database locks currently held
by this |
Rollback(ISavepoint) |
Undoes all changes made after the given |
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 |
SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from IJavaPeerable) |
SetPeerReference(JniObjectReference) |
Set the value returned by |
SetSavepoint() |
Creates an unnamed savepoint in the current transaction and
returns the new |
SetSavepoint(String) |
Creates a savepoint with the given name in the current transaction
and returns the new |
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) |