Joined: 06-Jun-2013
Hi, First time I tried to access an Oracle database and got this error. I am looking for any hint for solving this please (seemed like something wrong with my Oracle client but I am using ezconnect?)
jp
Oracle.DataAccess.Client.OracleException: The provider is not compatible with the ver sion of Oracle client
Unhandled Exception: System.TypeInitializationException: The type initializer for 'SD.LLBLGen.Pro.DQE.Oracle.DynamicQuer yEngine' threw an exception. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target o f an invocation. ---> System.TypeInitializationException: The type initializer for 'Oracle.DataAccess.Client.OracleClien tFactory' threw an exception. ---> Oracle.DataAccess.Client.OracleException: The provider is not compatible with the ver sion of Oracle client at Oracle.DataAccess.Client.OracleInit.Initialize() at Oracle.DataAccess.Client.OracleClientFactory..cctor() --- End of inner exception stack trace --- --- End of inner exception stack trace --- at System.RuntimeFieldHandle.GetValue(RtFieldInfo field, Object instance, RuntimeType fieldType, RuntimeType declarin gType, Boolean& domainInitialized) at System.Reflection.RtFieldInfo.UnsafeGetValue(Object obj) at System.Reflection.RtFieldInfo.InternalGetValue(Object obj, StackCrawlMark& stackMark) at System.Reflection.RtFieldInfo.GetValue(Object obj) at System.Data.Common.DbProviderFactories.GetFactory(DataRow providerRow) at System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName) at SD.LLBLGen.Pro.ORMSupportClasses.DbProviderFactoryInfo.get_FactoryToUse() in c:\Myprojects\VS.NET Projects\LLBLGen Pro v4.0\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\Persistence\DbProviderFactoryInfo.cs:line 214 at SD.LLBLGen.Pro.ORMSupportClasses.DbProviderFactoryInfo.InitializeEnumTypeCache() in c:\Myprojects\VS.NET Projects\ LLBLGen Pro v4.0\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\Persistence\DbProviderFactoryInfo.cs:line 137
at SD.LLBLGen.Pro.DQE.Oracle.OracleSpecificCreator.SetDbProviderFactoryParameterData(String dbProviderFactoryInvarian tName, String dbProviderSpecificEnumTypeName, String dbProviderSpecificEnumTypePropertyName) in c:\Myprojects\VS.NET Pro jects\LLBLGen Pro v4.0\Frameworks\LLBLGen Pro\RuntimeLibraries\OracleDQE\OracleSpecificCreator.cs:line 101 at SD.LLBLGen.Pro.DQE.Oracle.DynamicQueryEngine..cctor() in c:\Myprojects\VS.NET Projects\LLBLGen Pro v4.0\Frameworks \LLBLGen Pro\RuntimeLibraries\OracleDQE\DynamicQueryEngine.cs:line 92 --- End of inner exception stack trace --- at SD.LLBLGen.Pro.DQE.Oracle.DynamicQueryEngine..ctor() at SimpleDemo.Oracle.DatabaseSpecific.DataAccessAdapter.CreateDynamicQueryEngine() in d:\Documents\Visual Studio 2012 \Projects\LLBLGen_Projects\SimpleDemo\LLBLGen\Oracle (ODP.NET)\DatabaseSpecific\DataAccessAdapter.cs:line 97 at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.CreateSelectDQ(QueryParameters parameters) in c:\Myprojects \VS.NET Projects\LLBLGen Pro v4.0\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAccessAd apterBase.cs:line 4591 at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchTypedList(DataTable dataTableToFill, QueryParameters p arameters) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v4.0\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\A dapterSpecific\DataAccessAdapterBase.cs:line 3168 at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchTypedList(IEntityFields2 fieldCollectionToFetch, DataT able dataTableToFill, IRelationPredicateBucket filterBucket, Int32 maxNumberOfItemsToReturn, ISortExpression sortClauses , Boolean allowDuplicates, IGroupByCollection groupByClause, Int32 pageNumber, Int32 pageSize) in c:\Myprojects\VS.NET P rojects\LLBLGen Pro v4.0\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAccessAdapterBase .cs:line 3135 at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchTypedList(ITypedListLgp2 typedListToFill) in c:\Myproj ects\VS.NET Projects\LLBLGen Pro v4.0\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAcce ssAdapterBase.cs:line 2951 at SimpleDemo_VS.Program.FetchTypedList() in d:\Documents\Visual Studio 2012\Projects\LLBLGen_Projects\SimpleDemo\Vis ualStudio\SimpleDemo_VS\SimpleDemo_VS\Program.cs:line 139 at SimpleDemo_VS.Program.Main(String[] args) in d:\Documents\Visual Studio 2012\Projects\LLBLGen_Projects\SimpleDemo\ VisualStudio\SimpleDemo_VS\SimpleDemo_VS\Program.cs:line 171 Press any key to continue . . .
This happen on your generated code right? That means that it worked on LLBLGen Designer, right? What Oracle client version did you install? and... Was it x64 or x86? What version of ODP.Net do you have?
Joined: 06-Jun-2013
daelmo, Thank you for helping, on the questions you asked:
This happen on your generated code right? YES (running the generated code in VS2012)
That means that it worked on LLBLGen Designer, right? YES
What Oracle client version did you install? and... Was it x64 or x86? I have x64
What version of ODP.Net do you have? I have "ORACLE PROVIDERS FOR ASP.NET 11.2.0.1.0 Production" (I assuming the IDP.Net in Oracle installation area)
HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\ODP.NET\2.112.1.0
I still couldn't figure out what's wrong?
Joined: 06-Jun-2013
Walaa, It was set to Any CPU; no, it is not a Web application.
After reading your message I changed it to x64, recompiled and rerun, I now get a different error, System.ArgumentException: Unable to find the requested .Net Framework Data Provider. I copied it at the end.
Here is my connection string in Visual Studio app.config:
<appSettings>
<add key="ConnectionString.Oracle (ODP.NET)" value="Data Source=basehost:1521/demo;Persist Security Info=True;User ID=SimpleDemo;Password=SimpleDemo;Unicode=True"/>
</appSettings>
Please advise.
Thanks
jp
Unhandled Exception: System.TypeInitializationException: The type initializer for 'SD.LLBLGen.Pro.DQE.Oracle.DynamicQuer yEngine' threw an exception. ---> System.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed. at SD.LLBLGen.Pro.ORMSupportClasses.DbProviderFactoryInfo.get_FactoryToUse() in c:\Myprojects\VS.NET Projects\LLBLGen Pro v4.0\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\Persistence\DbProviderFactoryInfo.cs:line 212 at SD.LLBLGen.Pro.ORMSupportClasses.DbProviderFactoryInfo.InitializeEnumTypeCache() in c:\Myprojects\VS.NET Projects\ LLBLGen Pro v4.0\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\Persistence\DbProviderFactoryInfo.cs:line 138
at SD.LLBLGen.Pro.DQE.Oracle.OracleSpecificCreator.SetDbProviderFactoryParameterData(String dbProviderFactoryInvarian tName, String dbProviderSpecificEnumTypeName, String dbProviderSpecificEnumTypePropertyName) in c:\Myprojects\VS.NET Pro jects\LLBLGen Pro v4.0\Frameworks\LLBLGen Pro\RuntimeLibraries\OracleDQE\OracleSpecificCreator.cs:line 104 at SD.LLBLGen.Pro.DQE.Oracle.DynamicQueryEngine..cctor() in c:\Myprojects\VS.NET Projects\LLBLGen Pro v4.0\Frameworks \LLBLGen Pro\RuntimeLibraries\OracleDQE\DynamicQueryEngine.cs:line 97 --- End of inner exception stack trace --- at SD.LLBLGen.Pro.DQE.Oracle.DynamicQueryEngine..ctor() at SimpleDemo.Oracle.DatabaseSpecific.DataAccessAdapter.CreateDynamicQueryEngine() in d:\Documents\Visual Studio 2012 \Projects\LLBLGen_Projects\SimpleDemo\LLBLGen\Oracle (ODP.NET)\DatabaseSpecific\DataAccessAdapter.cs:line 97 at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.CreateSelectDQ(QueryParameters parameters) in c:\Myprojects \VS.NET Projects\LLBLGen Pro v4.0\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAccessAd apterBase.cs:line 4591 at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchTypedList(DataTable dataTableToFill, QueryParameters p arameters) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v4.0\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\A dapterSpecific\DataAccessAdapterBase.cs:line 3172 at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchTypedList(IEntityFields2 fieldCollectionToFetch, DataT able dataTableToFill, IRelationPredicateBucket filterBucket, Int32 maxNumberOfItemsToReturn, ISortExpression sortClauses , Boolean allowDuplicates, IGroupByCollection groupByClause, Int32 pageNumber, Int32 pageSize) in c:\Myprojects\VS.NET P rojects\LLBLGen Pro v4.0\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAccessAdapterBase .cs:line 3135 at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchTypedList(ITypedListLgp2 typedListToFill) in c:\Myproj ects\VS.NET Projects\LLBLGen Pro v4.0\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAcce ssAdapterBase.cs:line 2951 at SimpleDemo_VS.Program.FetchTypedList() in d:\Documents\Visual Studio 2012\Projects\LLBLGen_Projects\SimpleDemo\Vis ualStudio\SimpleDemo_VS\SimpleDemo_VS\Program.cs:line 140 at SimpleDemo_VS.Program.Main(String[] args) in d:\Documents\Visual Studio 2012\Projects\LLBLGen_Projects\SimpleDemo\ VisualStudio\SimpleDemo_VS\SimpleDemo_VS\Program.cs:line 171 Press any key to continue . . .
If your app is x64, ODP.NET's .NET code will load the 64bit client of Oracle. This 64bit client comes with 64bit ODP.NET. If your app is x86 or anyCPU, ODP.NET will load the 32bit client.
This is, I think, your first problem.
The problem you ran into now, is that the ODP.NET installer will register the factory in the .net 4 machine.config file and if your application is a .net 2/3.5 application, the CLR will look in the .net 2 machine.config file for the factory, which likely doesn't have the registration of the factory.
Simply install FULL ODP.NET, e.g. ODAC 11.2 Release 5 (11.2.0.3.20) with Xcopy Deployment from http://www.oracle.com/technetwork/developer-tools/visual-studio/downloads/index.html
You can also use the other one, with vs.net integration, but if you don't need that, you don't need that version.
The main thing is thus: - if the oracle client (CLI) is 32bit, and you start a x64 app, the client won't work - if the ODP.NET installer registered a factory in the .net 2.x machine.config, the factory isn't known for .NET 4 and vice versa. You can easily check this by checking the machine.config file of the two .net versions in the windows\Microsoft.NET\Framework folder
Joined: 06-Jun-2013
Thank you everyone, you all are so very helpful as always.
I obviously knew nothing about the .net 4.x vs .net 2.x machine.config business.
After downloading the 32 bit ODP things still did not work, including the designer. So I downloaded the 64 bit ODP and verified that when installing it would register in the .net 4.c machine.config, made sure that I have 64 bit Oracle client, and set my Visual Studio project explicitly to 64 bit. Now everything worked fine.
Thanks again!