Oracle client compatibility problems

Posts   
 
    
cgray
User
Posts: 62
Joined: 25-Nov-2007
# Posted on: 23-Jul-2009 02:47:15   

Hello, I am having problems with an error, "unable to cast object of type Oracle.DataAccess.Client.OracleConnection" (details below). I did see similar problems posted and have tried to solve this by removing and adding references and looking at redirection, but with no success. (The redirecting to a different assembly is a bit over my head.)

The weird part of this is that I have another project, with what I think is the same configuration, and it works just fine. The change is that the new project is built against the QA version of our database, not the test DB.

I have LLBLGenPro 2.6 Final (June 6, 200sunglasses on Windows XP. Using Visual Studio 2005, version 8.0.50727.762 .Net Framework version 2.0.50727 Sp1 Runtime version 2.0.50727 of the SD.LLBLGen.Pro classes.

I generated code using Adapter, single class. Our Oracle database is version 10g.

On my client computer I have installed three Oracle clients: 10.2, 11.1.0, and 11.1.0.6

I had hoped to use the Oracle Client 11, but it turns out that when I deploy I will need to use the 10.2 client version. However, things have worked fine so far with the more recent client and 10g database.

Thanks for any suggestions. I am willing to uninstall Oracle clients and reinstall, but hate to break my already working project.

Carol

Full error and stack trace:

Unable to cast object of type 'Oracle.DataAccess.Client.OracleConnection' to type 'System.Data.OracleClient.OracleConnection'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Unable to cast object of type 'Oracle.DataAccess.Client.OracleConnection' to type 'System.Data.OracleClient.OracleConnection'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[InvalidCastException: Unable to cast object of type 'Oracle.DataAccess.Client.OracleConnection' to type 'System.Data.OracleClient.OracleConnection'.] System.Data.OracleClient.OracleCommand.set_DbConnection(DbConnection value) +47 System.Data.Common.DbCommand.System.Data.IDbCommand.set_Connection(IDbConnection value) +45 SD.LLBLGen.Pro.ORMSupportClasses.Query..ctor(IDbConnection connectionToUse, IDbCommand commandToUse) +64 SD.LLBLGen.Pro.ORMSupportClasses.RetrievalQuery..ctor(IDbConnection connectionToUse, IDbCommand commandToUse) +33 SD.LLBLGen.Pro.DQE.Oracle.DynamicQueryEngine.CreateSelectDQ(IEntityFieldCore[] selectList, IFieldPersistenceInfo[] fieldsPersistenceInfo, IDbConnection connectionToUse, IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk, Boolean allowDuplicates, IGroupByCollection groupByClause, Boolean relationsSpecified, Boolean sortClausesSpecified) +251 SD.LLBLGen.Pro.ORMSupportClasses.DynamicQueryEngineBase.CreateSelectDQ(IEntityFieldCore[] selectList, IFieldPersistenceInfo[] fieldsPersistenceInfo, IDbConnection connectionToUse, IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk, Boolean allowDuplicates, IGroupByCollection groupByClause) +808 SD.LLBLGen.Pro.DQE.Oracle.DynamicQueryEngine.CreatePagingSelectDQ(IEntityFieldCore[] selectList, IFieldPersistenceInfo[] fieldsPersistenceInfo, IDbConnection connectionToUse, IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk, Boolean allowDuplicates, IGroupByCollection groupByClause, Int32 pageNumber, Int32 pageSize) +184 SD.LLBLGen.Pro.ORMSupportClasses.DynamicQueryEngineBase.CreateSelectDQ(IEntityFieldCore[] selectList, IFieldPersistenceInfo[] fieldsPersistenceInfo, IDbConnection connectionToUse, IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk, Boolean allowDuplicates, IGroupByCollection groupByClause, Int32 pageNumber, Int32 pageSize) +67 SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.CreateSelectDQ(IEntityFields2 fieldsToFetch, IFieldPersistenceInfo[] persistenceInfoObjects, IPredicateExpression filter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk, Boolean allowDuplicates, IGroupByCollection groupByClause, Int32 pageNumber, Int32 pageSize) +135 SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityCollectionInternal(IEntityCollection2 collectionToFill, IRelationPredicateBucket& filterBucket, Int32 maxNumberOfItemsToReturn, ISortExpression sortClauses, ExcludeIncludeFieldsList excludedIncludedFields, Int32 pageNumber, Int32 pageSize) +790 SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityCollection(IEntityCollection2 collectionToFill, IRelationPredicateBucket filterBucket, Int32 maxNumberOfItemsToReturn, ISortExpression sortClauses, IPrefetchPath2 prefetchPath, ExcludeIncludeFieldsList excludedIncludedFields, Int32 pageNumber, Int32 pageSize) +147 SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityCollection(IEntityCollection2 collectionToFill, IRelationPredicateBucket filterBucket, Int32 maxNumberOfItemsToReturn, ISortExpression sortClauses, IPrefetchPath2 prefetchPath, Int32 pageNumber, Int32 pageSize) +54 SD.LLBLGen.Pro.ORMSupportClasses.LLBLGenProDataSourceView2.ExecuteSelectEntityCollection(Int32 pageSize, Int32 pageNumber, DataSourceSelectArguments arguments) +683 SD.LLBLGen.Pro.ORMSupportClasses.LLBLGenProDataSourceView2.ExecuteSelect(DataSourceSelectArguments arguments) +330 System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +17 System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149 System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70 System.Web.UI.WebControls.GridView.DataBind() +4 System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82 System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +69 System.Web.UI.Control.EnsureChildControls() +87 System.Web.UI.Control.PreRenderRecursiveInternal() +50 System.Web.UI.Control.PreRenderRecursiveInternal() +170 System.Web.UI.Control.PreRenderRecursiveInternal() +170 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2041

Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 23-Jul-2009 02:57:30   
David Elizondo | LLBLGen Support Team
cgray
User
Posts: 62
Joined: 25-Nov-2007
# Posted on: 24-Jul-2009 00:51:55   

This posting about the details of Oracle client dll properties was very interesting and useful. I will be revisiting this site. I tried the redirection setting suggested in my web.config, using the versions of the assemblies that I found on my computer in C:\WINDOWS\assemblies, but still got the casting error. It is quite likely that I didn't have an accurate or proper redirection specified. I still have this project and will try and resolve the version issue, as I have a feeling this will come up again.

However, in the meantime I decided to create a new project and regenerate new classes. Taking great care to delete references and add back the correct versions to use, this time I got a successful database connection and no exceptions (so far).

Thanks very much for the quick reply and link to the detailed Oracle information.

Carol