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
CreateDataSourceEnumerator
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: CreateDataSourceEnumerator
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:
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"]);
}
}