Compartilhar via


IDataSource Interface

Definition

A factory for connections to the physical data source that this DataSource object represents.

[Android.Runtime.Register("javax/sql/DataSource", "", "Javax.Sql.IDataSourceInvoker")]
public interface IDataSource : IDisposable, Java.Interop.IJavaPeerable, Java.Sql.IWrapper, Javax.Sql.ICommonDataSource
[<Android.Runtime.Register("javax/sql/DataSource", "", "Javax.Sql.IDataSourceInvoker")>]
type IDataSource = interface
    interface IWrapper
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
    interface ICommonDataSource
Attributes
Implements

Remarks

A factory for connections to the physical data source that this DataSource object represents. An alternative to the DriverManager facility, a DataSource object is the preferred means of getting a connection. An object that implements the DataSource interface will typically be registered with a naming service based on the Java<sup><font size=-2>TM</font></sup> Naming and Directory (JNDI) API.

The DataSource interface is implemented by a driver vendor. There are three types of implementations: <OL> <LI>Basic implementation -- produces a standard Connection object <LI>Connection pooling implementation -- produces a Connection object that will automatically participate in connection pooling. This implementation works with a middle-tier connection pooling manager. <LI>Distributed transaction implementation -- produces a Connection object that may be used for distributed transactions and almost always participates in connection pooling. This implementation works with a middle-tier transaction manager and almost always with a connection pooling manager. </OL>

A DataSource object has properties that can be modified when necessary. For example, if the data source is moved to a different server, the property for the server can be changed. The benefit is that because the data source's properties can be changed, any code accessing that data source does not need to be changed.

A driver that is accessed via a DataSource object does not register itself with the DriverManager. Rather, a DataSource object is retrieved though a lookup operation and then used to create a Connection object. With a basic implementation, the connection obtained through a DataSource object is identical to a connection obtained through the DriverManager facility.

Added in 1.4.

Java documentation for javax.sql.DataSource.

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.

Properties

Connection

Creates a connection to the database represented by this DataSource.

Handle

Gets the JNI value of the underlying Android object.

(Inherited from IJavaObject)
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)
LoginTimeout

While attempting to connect to a database, this method get the maximum time in seconds that this data source can wait.

(Inherited from ICommonDataSource)
LogWriter

Retrieves a log writer which is a character output stream to which all logging and tracing messages for this data source will be printed.

(Inherited from ICommonDataSource)
ParentLogger (Inherited from ICommonDataSource)
PeerReference

Returns a JniObjectReference of the wrapped Java object instance.

(Inherited from IJavaPeerable)

Methods

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)
GetConnection(String, String)

Attempts to establish a connection with the data source that this DataSource object represents.

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)
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)
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