• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 791
  • Last Modified:

Oracle clients and bit-ness

We have what I believe is an old .net application (probably not 4.0), that connects to Oracle, accepts a primary key for input, and creates/produces insert/delete statements.  The purpose is to copy data from our QA system to our DEV system.

We recently started using Windows 7 64-bit.  We have Oracle WebLogic 11g 64-bit installed; I also have Oracle InstantClient 32-bit installed.  Related to the instant client, I also have TNS_ADMIN set to the instant client directory where I have a copy of my tnsnames.ora file.

This .net application works fine for me (actually, works fine for me on two different windows 7 machines).  However, for other users with the same* setup, the .net app is throwing an error when we try to log into the db: "Attempt to load Oracle client libraries threw BadImageFormatException.  This problem will occur when running in 64-bit mode with the 32-bit Oracle client components installed."

It almost seems like the .net app does not recognize that the instant client exists; the instant client was installed after WebLogic.

I can't figure out what I did differently that makes it work for me and not for others.  Everything that I find on google says, "install a 32-bit client" and the asker says, "thanks - that worked."  

*Possibly related, I installed everything myself by talking one of the desktop guys into giving me admin rights for a couple of days.  Everyone else's machines were installed by someone on the desktop team.  The only point of contention seems to be that I installed Java into C:\Java, and the desktop team insists on installing to C:\Program Files\Java or C:\Program Files (x86)\Java.  (To install WebLogic, they installed Java to C:\Program Files\Java and then copied to C:\Java, which seemed to work.)  

It's very possible that we have different permissions set, but I don't know where to start looking.

As an alternative to solving the problem above, a recommendation of a good beginner's tutorial to .net would be helpful, since I don't have a clue how to tear this application apart.  

Thanks!
0
tancat
Asked:
tancat
  • 5
  • 4
3 Solutions
 
Bob LearnedCommented:
Things to think about:

1) How many different clients are installed on a non-working machine?

2) What type of application are you working with (Windows Forms, WPF, Windows Service, ...)?

3) I use the fully managed .NET provider now, with my .NET applications, which is one file, and doesn't need an installed client.
0
 
tancatOracle DeveloperAuthor Commented:
1) On the non-working machines, there is either a) WebLogic/Forms/Reports (64-bit), or b) WebLogic/Forms/Reports (64-bit) and the instant client (32-bit).  There are no other clients installed on the non-working machines.  They are newly formatted/imaged, so nothing left over from previous users.  On my working machines, I have WebLogic/Forms/Reports (64-bit) and the instant client (32-bit) installed.  

2) We have WebLogic/Forms/Reports installed because we develop Oracle Forms, but the app we are having problems with is .NET.  I might not be understanding your question.  

3) We don't develop .NET apps, we only use this one which connects to our database using TNSNAMES.  We have no .NET tools installed.
0
 
Bob LearnedCommented:
This kind of problem can be difficult to troubleshoot locally, so it is a lot more difficult for me.

It would seem to be a problem with the Oracle client, and how the .NET application is behaving on different machines.

What version of the Instant Client do you have installed?

What type of .NET application are you working with (desktop, web site, Windows Service, ...)?
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
tancatOracle DeveloperAuthor Commented:
The Instant Client is 11g 32-bit basic (no jdbc, sqlplus, sdk, etc.).

The .NET app is a desktop app; we double-click on an exe file.  

I forgot to mention that the other machines were all created from an image, whereas the two that work, were not.  The two that work, I was given admin privileges and installed everything myself (as the end user); on the others, I guess everything was installed by an administrator from the image; however, in both cases, the end user installed both the instant client and the .NET app (since neither were actually installed, they were just unzipped).  

The only other idea I have is to take a spare windows 7 machine, wipe everything, and install just the instant client and the .NET app and see what happens.  But its incredibly difficult to get permission to do something like that, so I'd rather not have to go down that road.
0
 
Bob LearnedCommented:
Reference:

BadImageFormatException Class
http://msdn.microsoft.com/en-us/library/system.badimageformatexception.aspx

A DLL or executable is loaded as a 64-bit assembly, but it contains 32-bit features or resources. For example, it relies on COM interop or calls methods in a 32-bit dynamic link library.
To address this exception, set the project's Platform target property to x86 (instead of x64 or AnyCPU) and recompile.

Components have been created using different versions of the .NET Framework. Typically, this exception occurs when an application or component that was developed using the .NET Framework 1.0 or the .NET Framework 1.1 attempts to load an assembly that was developed using the .NET Framework 2.0 SP1 or later, or when an application that was developed using the .NET Framework 2.0 SP1 or .NET Framework 3.5 attempts to load an assembly that was developed using the .NET Framework 4. The BadImageFormatException may be reported as a compile-time error, or the exception may be thrown at run time. The following example illustrates this scenario. It defines a StringLib class that has a single member, ToProperCase, and that resides in an assembly named StringLib.dll.
0
 
tancatOracle DeveloperAuthor Commented:
The thing is, I don't know .NET nor do I have any .NET tools (at the moment), and we don't have any .NET resources to modify the app for us.  

So unless I find a windows- or oracle-related solution, I would need a good beginner's tutorial for .NET (something like ".NET for Oracle Dummies")

On one of my windows 7 machines, I removed everything and installed just Instant Client and the .NET app, and received a new error, "System.Data.OracleClient requires client software version 8.1.7 or greater" which I'm researching.  Fiddling with the permissions didn't seem to help, and its possible that I messed up a registry setting trying to eliminate all previous versions of Oracle.  

I also discovered that both machines that work with this .NET app have Oracle XE 11g databases installed, which doesn't make sense that this could have anything to do with the app working, but i thought I would mention it.
0
 
slightwv (䄆 Netminder) Commented:
A lot depends on what access provider the app is using.

It is likely using the Microsoft drivers 'for Oracle'.  I believe these sit on top of the OleDB drivers but don't quote me on this.

When you installed the Instant Client, did you also download and install the OleDB add on?

As for not knowing .Net, you can use a tool like dotPeek to disassemble the code and look at the source.  Not great for actually making changes but good enough to at least look at the drivers being used to connect to Oracle.

You can get dotPeek here:
http://www.jetbrains.com/decompiler/
0
 
Bob LearnedCommented:
Installing Oracle for .NET can be confusing, because you need to get the correct version for the Oracle .NET Data Provider, otherwise it will complain very loudly.

If the application is not using the Oracle data provider, but the internal Microsoft version, then that is a horse of a different color.
0
 
tancatOracle DeveloperAuthor Commented:
I finally got it to work on the other machines.  I took the 26 files that are in the instant_client folder and dumped them into the same folder that the .NET app is in, along with the tnsnames.ora file.  Recalling something from my research, I now think that I probably didn't need all 26 files, but since that works, I'm going with it (KISS).  

It does seem like the .NET app just didn't realize that the instant client was there.  Why it did on my computer, and not on the rest, is still a mystery, but since this solution works, I'm not going to continue researching (for now).  

TheLearnedOne - now that you mention it, maybe the .NET app was written so long ago that it didn't recognize 11g, and it might have worked as-is with an earlier version of instantclient.  

Slightwv - I did try dotPeek, but at the time we were just starting our Forms upgrade and I didn't have much time to dig in.

If you don't mind, I'll split the points between you.  I did figure out this solution right after my last post, but the dotPeek app could somewhat be considered a learning tool, and using an earlier version of InstantClient may have worked, too.

Thanks!!
0
 
tancatOracle DeveloperAuthor Commented:
I don't know the reason why my solution worked, it just did.  It may not have been the only solution, as the Experts later provided two possible solutions that I just don't have time to test right now.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now