Could not load file or assembly 'System.Data.OracleClient'

Topics: Data Access Application Block
Jul 19, 2009 at 5:47 PM

I get this error when trying using DatabaseFactory.CreateDatabase()

I am trying to connect to a SQL server. Why is it trying to load OracleClient?

Any help?

The current build operation (build key Build Key[Microsoft.Practices.EnterpriseLibrary.Data.Database, PSConnection]) failed: Could not load file or assembly 'System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. Access is denied. (Strategy type ConfiguredObjectStrategy, index 2)

Jul 20, 2009 at 7:38 AM
Edited Jul 20, 2009 at 7:51 AM

Hi,

First of all, you need to verify that you are really connecting to a sql server database. This is just weird.  Can you provide more context about your application? Is this a web application? If it is, Do you use impersonation? Do you have other connection strings defined in your config? would you mind posting the full stack trace maybe we could see where the error originated.

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jul 23, 2009 at 6:45 PM

Hi,

Sorry about the delay in the response.

My application is a ASP.Net web application which uses WCF. When an exception is caught in my web application, a WCF method is called which tries to log into the DB through an SP. When trying to use DatabaseFactory.CreateDatabase()  I get the above said exception. The server i am trying to connect is a SQL server and the provider name in the config file is "system.data.sqlclient"

Jul 24, 2009 at 9:06 AM

Do you have a full stack trace for this one?

Jul 24, 2009 at 4:11 PM

Here you go...

INNER EXCEPTION: at Microsoft.Practices.EnterpriseLibrary.Data.DatabaseConfigurationView.GetDefaultMapping(String name, String dbProviderName)
   at Microsoft.Practices.EnterpriseLibrary.Data.DatabaseConfigurationView.GetProviderMapping(String name, String dbProviderName)
   at Microsoft.Practices.EnterpriseLibrary.Data.DatabaseCustomFactory.CreateObject(IBuilderContext context, String name, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.ConfiguredObjectStrategy.PreBuildUp(IBuilderContext context)
   at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)

OUTER EXCEPTION: at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)
   at Microsoft.Practices.ObjectBuilder2.Builder.BuildUp(IReadWriteLocator locator, ILifetimeContainer lifetime, IPolicyList policies, IStrategyChain strategies, Object buildKey, Object existing)
   at Microsoft.Practices.ObjectBuilder2.Builder.BuildUp[TTypeToBuild](IReadWriteLocator locator, ILifetimeContainer lifetime, IPolicyList policies, IStrategyChain strategies, Object buildKey, Object existing)
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory.BuildUp[T](IReadWriteLocator locator, ILifetimeContainer lifetimeContainer, String id, IConfigurationSource configurationSource)
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory.BuildUp[T](String id, IConfigurationSource configurationSource)
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.NameTypeFactoryBase`1.Create(String name)
   at Microsoft.Practices.EnterpriseLibrary.Data.DatabaseFactory.CreateDatabase(String name)
   at Tomra.Enterprise.PS.DAO.SmartClientDAO.PullMachineInfo(Int32 storeID, StructRVMFamilyCommands[]& RVMFamilyCommands)

Jul 24, 2009 at 6:46 PM

Any updates?

Jul 26, 2009 at 12:43 AM

 

What does your config file look like?

Jul 26, 2009 at 6:18 PM
Edited Aug 5, 2009 at 12:26 PM

<Removed config file>

Jul 27, 2009 at 12:36 AM

You should go change the passwords on your database accounts now, since you just published them to the world.

There's a ton of stuff in there I don't care about, so it'll take time to pick through this.