Hello Nathan, On Monday, 13 May 2013 19:53:09 UTC-4, Nathan Palmer wrote: > > I haven't used the Devart objects before. But to get the text you need for > the configuration try to put a line like this at the beginning of your > program. Then pull the result out and put it in the text file. > > var fullName = typeof(OracleConnection).AssemblyQualifiedName; >
Okay, great. It looks like this works! > > As for the DbConnectionFactory.... maybe? Is that useful to you? It sounds > like you have something working. Do you want to share what that looks like? > In scanning the list, at least two others have had the same error I did. Here it is. This change is completely generic and could make for less headaches for people like me who are not as familiar with ADO.NET. I tried to make the message in the exception very explicit as to how the connection was attempted. The logic is almost straight off the API page: /// <summary> /// Creates an open connection for a given connection string setting using the provider /// name to select the proper implementation first using Type.GetType() and if that fails, /// the DbProviderFactories are attempted. /// </summary> /// <param name="connectionString">ConnectionStringSetting node</param> /// <returns>The open connection</returns> public static IDbConnection Connection(ConnectionStringSettings connectionString) { if (connectionString == null) throw new InvalidOperationException("Null ConnectionStringSettings specified"); // Original logic //Type type = Type.GetType(connectionString.ProviderName); //if (type == null) // throw new InvalidOperationException("The type name '" + connectionString.ProviderName + // "' could not be found for connection string: " + connectionString.Name); //IDbConnection connection = (IDbConnection)Activator.CreateInstance(type); IDbConnection connection = null; try { Type type = Type.GetType(connectionString.ProviderName); if (type != null) { connection = (IDbConnection)Activator.CreateInstance(type); } else { DbProviderFactory factory = DbProviderFactories.GetFactory(connectionString.ProviderName); connection = factory.CreateConnection(); } } catch (System.ArgumentException ae) { throw new InvalidOperationException("For providerName '" + connectionString.ProviderName + "', 1) Lookup via Type.GetType() failed and, 2) Lookup via DbConnectionFactory failed " + "in connection string: " + connectionString.Name + "; message: " + ae.InnerException.Message); } connection.ConnectionString = connectionString.ConnectionString; connection.Open(); return connection; } When viewing the DbConnectionFactories on my machine.config, there was an entry for SqlServer and entries for Devart Oracle and Oracle ODP.NET because I installed the latter two drivers. So in any of these cases, specifying a strong name for the providerName connection information would not be necessary. Hope this is useful, -Bill > Nathan > > > On Mon, May 13, 2013 at 2:53 PM, Bill Burton <bburt...@gmail.com<javascript:> > > wrote: > >> Hello, >> >> I've been attempting to use Rhino.Etl to import an XML file into an >> Oracle database using the Devart dotConnect driver. Ran into problems >> where the method: >> >> public static IDbConnection Connection(ConnectionStringSettings >> connectionString) >> >> could never find the Devart driver. The culprit is the following line in >> that method: >> >> Type type = Type.GetType(connectionString.ProviderName); >> >> Someone on this list mentioned that a strong name has to be used for the >> providerName. So I tried that and it still failed with a different error. >> I suppose I didn't specify the strong name correctly but I have no idea >> what to change to fix it. >> >> My only alternative was to then to implement a custom >> OutputCommandOperation with it's own connection logic cloned from >> Use.Connection but otherwise had a significant amount of redundant code >> from the original with the only difference being that it instantiates the >> OracleConnection class. >> >> Then one day while trolling through the machine.config for no good >> reason, I stumbled upon a configuration for <DbConnectionFactories>. After >> looking into this, patched the Use.Connection method so if the >> Type.GetType() call returns null, it will then >> try DbProviderFactories.GetFactory(). Only if both these methods fail will >> an InvalidOperationException be thrown with a detailed message indicated >> how the connection attempts were made. >> >> Does adding DbConnectionFactory support seem like a useful enhancement? >> >> Thanks, >> -Bill >> > > -- You received this message because you are subscribed to the Google Groups "Rhino Tools Dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to rhino-tools-dev+unsubscr...@googlegroups.com. To post to this group, send email to rhino-tools-dev@googlegroups.com. Visit this group at http://groups.google.com/group/rhino-tools-dev?hl=en. For more options, visit https://groups.google.com/groups/opt_out.