Page 1 of 1
CreateDataSourceEnumerator
Posted: Mon 21 Jan 2013 13:57
by jomaa
DbProviderFactory factory = DbProviderFactories.GetFactory("Devart.Data.Oracle");
bool canCreate = factory.CanCreateDataSourceEnumerator;
for the variable 'canCreate' I always get 'false', but that's not correct. Is this a bug?
I use the latest version of dotConnect for Oracle
Re: CreateDataSourceEnumerator
Posted: Thu 24 Jan 2013 09:01
by Pinturiccio
dotConnect for Oracle cannot look for servers in the Direct mode. In the OCI mode, we take servers from tns.names. For factory.CanCreateDataSourceEnumerator the value equal to 'false' is returned, as we cannot use DbDataSourceEnumerator for one of the connection modes.
However, you can use OracleDataSourceEnumerator under explicit usage of dotConnect for Oracle. Below is the example of how servers can be found using the OracleDataSourceEnumerator class:
Code: Select all
OracleHomeCollection homes = OracleConnection.Homes;
foreach (OracleHome h in homes) {
Console.WriteLine("=== Home={0} ===", h.Name);
OracleDataSourceEnumerator en = new OracleDataSourceEnumerator();
DataTable tbl = en.GetDataSources(h.Name);
foreach (DataRow row in tbl.Rows) {
Console.WriteLine(row["InstanceName"]);
}
}