InvalidOperationException connecting to Oracle

Topics: Data Access Application Block
Dec 3, 2012 at 4:28 AM
Edited Dec 3, 2012 at 4:30 AM

mracharjya wrote:

Hi,

I am getting the below error to connect oracle DB.

System.InvalidOperationException: The type Database cannot be constructed. You must configure the container to supply this value.

 

<

 

 

dataConfiguration defaultDatabase="OracleConnection" 

 

> 

<

 

 

 

 

providerMappings 

 

> 

<

 

 

 

 

add databaseType="Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="Oracle.DataAccess.Client" 

 

/> 

</

 

 

 

 

providerMappings 

 

> 

</

 

 

 

 

dataConfiguration 

 

>

 

 

  

<

 

 

connectionStrings 

 

>

 

 

  

<

 

 

add name="OracleConnection" connectionString="User Id=userid;Password=xxxxxx;DataSource=yyyyyy" providerName="Oracle.DataAccess.Client" 

 

/>

 

 

</

 

 

 

 

 

 

connectionStrings 

 

>

 

 

Regards,

Mano

Dec 3, 2012 at 4:34 AM

Maybe your configuration got mangled during posting (use the insert code snippet functionality to ensure it turns out correct) but it doesn't look valid.  Are you using the EntlibContrib Oracle Database?  If so then I would expect to see something like:

<dataConfiguration defaultDatabase="DefaultConnectionString"> 
  <providerMappings> 
    <add databaseType="EntLibContrib.Data.OdpNet.OracleDatabase, EntLibContrib.Data.OdpNet, Version=5.0.505.0, Culture=neutral, PublicKeyToken=null" name="Oracle.DataAccess.Client"/> 
  </providerMappings> 
</dataConfiguration>

Another potential cause might be that the DbProviderFactories are not configured.  See this thread: http://entlib.codeplex.com/discussions/394482.  

--
Randy Levy
Enterprise Library support engineer
entlib.support@live.com