Link to home
Start Free TrialLog in
Avatar of x77
x77Flag for Spain

asked on

Net Assembly policy redirect - Oracle.DataAccess

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.
ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of x77

ASKER

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.
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

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.
Avatar of x77

ASKER

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.
Avatar of x77

ASKER

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:
 User generated image
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


Avatar of x77

ASKER

Comment is very useful and I try it in future.

By now I use the comented solution.
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.
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).
Avatar of x77

ASKER

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 ?
For me, the size isn't a concern. A few 100k is just lost in the noise. What is important is stability, cost, productivity.
Avatar of x77

ASKER

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.
Avatar of x77

ASKER

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.