Solved

Net Assembly policy redirect - Oracle.DataAccess

Posted on 2011-09-21
12
1,178 Views
Last Modified: 2012-05-12
I use Oracle.DataAccess 9.2 dll with my program at same directory.

I do this as all Clients have Oracle 9.2 Client installed but without Oracle.DataAccess.

Now, I find some clients that have Installed Oracle 10 Client with  Oracle.DataAccess 10.

My Program fails on those clients as my Program can´t Link to Oracle.DataAccess 10

I inspect    Windows - Assembly directory and  Find  installed  Policy  to redirect    Oracle.DataAccess  from 9.2 to 10

If I Remove this Policy, my program works with Oracle.DataAccess 9.2

I don´t want remove this policy, as it is correct.

How can I modify my program to support Oracle.DataAccess 10 ?
Note that I compile with reference to Oracle.DataAccess 9.
I don´t have Oracle.DataAccess 10 on my machine.
0
Comment
Question by:x77
  • 7
  • 3
  • 2
12 Comments
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 36573245
I've never tried this but an Expert I trust posted this a while back that might help:

http://www.experts-exchange.com/Database/Oracle/Q_27020817.html?#a35709210
0
 
LVL 15

Author Comment

by:x77
ID: 36574807
Thanks.

I examine now two solutions.

1 - Avoid Redirection using app.config or any other code file, or using loadAssembly.

    I think this is the best as I put executables on network and big files can slow down.
 
2 - Compile with Oracle.DataAccess 10 or 11 and forze Know TnsNames.

     I Find this morning  Dll´s for that on Oracle 11, but It don´t work as it do´nt find TnsNames (TnsAdmin ?).
     Note that I have also Oracle8 installed and I also need forze Oracle9 (DllPath).

I think -2- is hard to test. I need also test too many routines to prevent compatibility issues.
Solution -1- don´t need any aditional test.

I discard move to OleDb, this work but this app uses Oracle Array binding and has heavy workload.

By now, I can modify each Pc removing redirection at Windows\Assembly, but it is a temporary solution.
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 36574836
Is there a question in there or are you just commenting?

If you scroll down a little farther in the link I provided the Expert recommends: DevArt's dotConnect for Oracle for the version issue.
0
 
LVL 15

Author Comment

by:x77
ID: 36577192
I know  DevArt's software. It is also a great option.

But there are about 700 PTI. Each PTI has a lot of sofware installed,  Software is normalized and suported by other departament. I can´t decide about software distribution.

I searched on web, and get a lot questions about this problem.

I understand now installation for these  "Redirect Policy" on developer machines, but i don´t understand this on standard user machines as it break compatibility between distinct final applications.

I opened yesteday a Incidence to software distribution departament, but I want know more options before propose any solution.

Thanks.
0
 
LVL 15

Author Comment

by:x77
ID: 36581208
Resolved !!

I inspect Policy.9.2.Oracle.DataAccess.config Redirect file:
<configuration>
   <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
          <assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89B483F429C47342"/>
            <bindingRedirect oldVersion="9.2.0.000-9.2.0.999" newVersion="1.102.2.20"/>
        </dependentAssembly>
      </assemblyBinding>
   </runtime>
</configuration>

Open in new window


Then I install Policy.9.2.Oracle.DataAccess.dll in GAC  to test it.

Program Fails:
 Error Redirect Oracle 10
Then I Modify my App.Config:

I Add at assemblyBinding section:
 
<runtime>
	<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
.....
      <dependentAssembly>
         <assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89B483F429C47342"/>
         <publisherPolicy apply="no"/>
      </dependentAssembly>

Open in new window


I take assemblyIdentity Section from Previous File and Paste into my App.Config.
Then Replace bindingRedirect  with <publisherPolicy apply="no"/>
http://msdn.microsoft.com/es-es/library/cf9025zt(v=vs.90).aspx


0
 
LVL 15

Author Closing Comment

by:x77
ID: 36581238
Comment is very useful and I try it in future.

By now I use the comented solution.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 40

Expert Comment

by:mrjoltcola
ID: 36581300
Glad it helped. I will summarize my solution here (slightwv asked me to look in).

You basically have 3 options:
1) Use assembly redirection using a policy redirect in your app.config. Looks like you finally made this work.
2) Use reflection to load Oracle.DataAccess (a lot of work, not recommended, but allows your program to avoid linking against specific ODP.NET)
3) Use DevArt's driver (their driver also wraps OCI, the native Oracle client) and let it take care of loading whatever version of client is on the deployed PC. Deploy DevArt assembly with your app. It is small, and allows you to better control the deployed environment than even using ODP.NET.

I use #3 in most cases.
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 36581346
X77,

I have no problems is you want to have this reopened and continue on with mrjoltcola directly.

Just say so and he can reopen this (I'm on mobile today and cannot).
0
 
LVL 15

Author Comment

by:x77
ID: 36581477
I do some test with DevArt some time ago with evaluation license.

I try it to test Linq to Sql.

I don't test any other funcionality.
I don't examine the size of distribution drivers.

Odp - Oracle 9 requires :

Oracle.DataAccess.dll      - 504k
OraOps9.dll                     - 296k

I know that Odp-11 requires aditional dll´s and also duplicates size.

Note that is on a Network Drive used of anywhere.
Supports this DevArt  license ?
0
 
LVL 40

Expert Comment

by:mrjoltcola
ID: 36584069
For me, the size isn't a concern. A few 100k is just lost in the noise. What is important is stability, cost, productivity.
0
 
LVL 15

Author Comment

by:x77
ID: 36584930
Yes, Iam in agreement about this.

Also I have some problemns with ODP:

When use Oracle-Arrays to update Database and there are no errors, all is ok.
But when some rows fails to Update (constraints), it don´t support to return each row error.
This works ok when I work with OCI and C++, but I try with ODP-9 AND ODP-11 and it fails when error count > 4 or 5.
0
 
LVL 15

Author Comment

by:x77
ID: 36584962
ODP also fails to return errors on Sql-Parse:

When I use OCI, I can get the correct error message and position on Sql-Source.
Then on Dynamic Sql (User build Where condition), I shows where is the error.

ON ODP, most times the message is incorrect and I can´t get error position on Sql-Source.

I would try DevArt with those topics and then I decide.

0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Convert Oracle data into XML document 2 38
Round a string to two digits 12 24
dates - loop 12 41
Getfiles in vb.net 28 18
Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now