|Using GemFire XD.NET / Developing ADO.NET Client Applications|
The GemFire XD ADO.NET driver is an implementation of Microsoft's ADO.NET interfaces and abstract classes. It provides connectivity to a GemFire XD system as a network client driver. In this release of GemFire XD, the ADO.NET driver does not support running a GemFire XD member in an embedded mode (embedded driver) within an application.
You can access the driver through any .NET language including C#, C++/CLI, and Visual Basic .NET. As with the JDBC network driver, the ADO.NET driver complies with the DRDA standard protocol and utilizes several GemFire XD extensions to provide enhanced features.
The ADO.NET driver maintains information about the servers available in a GemFire XD cluster. If the server to which the client is connected goes down, then the driver automatically re-routes the connection to another server available in the cluster.
To take full advantage of this feature, clients should connect using the address of a stand-alone GemFire XD locator rather than a GemFire XD server, because locators provide more accurate information about the available servers to which a client can fail over. If you specify the address of a server rather than a stand-alone locator, then it is possible that the client will fail to find any available server if those servers have been taken offline.
If the application is not executing a transaction, then failover occurs transparently to the application. Failed operations are automatically re-executed if necessary. The application does not receive any exceptions as long as at least one server is available in the cluster to service network clients.
However, when querying LOB data-types (BLOB/CLOB), clients may receive an GFXDException with State "XJ217" due to the LOB handle not being found on the new server. In this case, the client may need to retry the query explicitly.
In this release of GemFire XD, if the application is in the middle of a transaction and the server to which client is connected fails, then the current transaction fails with a connection exception (GFXDException with State "08006") and the application must re-execute the transaction. To handle such a case, applications can create a new connection, and then begin a new transaction and retry the transaction.
When using the GemFire XD locator or a locator embedded inside a server, servers inform the active locator of the load on each server using the number of current client connections on the server. This allows the locator to determine the best server to use for a new client connection. In this way, a network client that connects using a locator is always directed to the least-loaded server in the cluster.
Similar to the JDBC API, the ADO.NET driver provides extensions to the DbCommand API to allow for batching without requiring a DbDataAdapter. Also, the DbDataReader implementation, GFXDDataReader, allows for expressing the intent to lock rows when executing a SELECT … FOR UPDATE statement. Additional extensions from the JDBC API are also provided, such as GFXDConnection.AutoCommit.