Solved

Net Assembly policy redirect - Oracle.DataAccess

Posted on 2011-09-21
12
1,189 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
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.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

863 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

19 Experts available now in Live!

Get 1:1 Help Now