CreateDataSourceEnumerator

CreateDataSourceEnumerator

Postby jomaa » Mon 21 Jan 2013 13:57

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
jomaa
 
Posts: 6
Joined: Mon 22 Mar 2010 09:55

Re: CreateDataSourceEnumerator

Postby Pinturiccio » Thu 24 Jan 2013 09:01

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


Return to dotConnect for Oracle