attempt to load oracle client libraries threw badimageformatexception - c#-4.0

I am using Visual Studio 2012. I installed Oracle 64bit Client. My Operating system is Win7 64 bit. I want add a new Oracle DB connection but when I enter username password etc. and click 'Test Connection' button, I see this error:
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.
But my Oracle Client is 64 bit. There is no any 32 bit component on my system.
I am also having problem on Oracle.DataAccess.dll added to my references. I tried EVERY COMBINATION which is Any CPU, x86i x64 platforms but nothing has changed. Everytime I get BadImageFormatException.
I searched for another questions but nothing has changed. I also tried IIS App Pool Enable 32bit applications property to True but it doesnt work.
Any suggestions? What else I can try?

Related

Power Query and the Oracle Ora-12154 error

I can connect to the client's Oracle database using the full connection string in Power Pivot. However, I need to connect in Power Query which throws an error when attempting to use the full connection string because it exceeds the 128-character limit. So I attempted to use EZConnect and a TNS name in Power Query but both generate an ORA-12154 error message. I get the same error message when I attempt to use EZConnect or a TNS name in Power Pivot. a duplicate of the TNSnames.ora file is read successfully on at least one other machine on the same network.
The exact error message is:
"Unable to connect. We encountered an error while trying to connect. Details: 'Oracle: ORA-12154: TNS could not resolve the connect identifier specified"
.
SYSTEM DETAILS
OS
Windows 7 Enterprise 64-bit machine
Applications
Microsoft Excel 2013 32 bit
Oracle 11gR202 Client 32 bit
(from the client's approved installs site, i.e. not the version available from Oracle downloads)
Oracle 11gR202 Client 64 bit
(from the client's approved installs site, i.e. not the version available from Oracle downloads)
OraDB11g_home1
(this was the original installation from the oracle downloads site. during the installation process, the installer displayed many "file not found error messages," i assumed this meant that this version lacks a flag which marks it as approved for the client's system. so i installed the client approved versions above which resulted in being able to connect via Power Pivot using the full connection string).
instantclient_12_1 (C:\Program Files\instantclient_12_1)
Configurations
TNS_ADMIN
- System and User Variable(identical copies of a TNSnames.ora file is in both locations):
C:\oracle\network\admin;
C:\app\nd369d\product\11.2.0\dbhome_1\NETWORK\ADMIN
PATH
- System variable:
C:\Oracle\11gR202Client64bit\bin\;
C:\Oracle\11gR202Client32bit\bin\;
C:\ProgramData\Oracle\Java\javapath;
C:\Program Files\instantclient_12_1;
C:\app\nd369d\product\11.2.0\dbhome_1\BIN;
C:\oracle
JAVA
(i updated to Java 8 update 66 from the client's installs site. while the procedure installed the update, it didn't remove the earlier version so now both are present on the machine):
Java 7 Update 51 (64 bit)
Java 7 Update 51
Java 8 Update 66 (64 bit)
Java 8 Update 66
You're having multiple oracle clients installed, and very likely they have different tnsnames.ora and sqlnet.ora variants.
See also this: http://www.orafaq.com/forum/t/74793/
check if sql*plus works from the command line with a tns name
check your tnsnames.ora config file, I found it is quite error prone with those many parenthesis :)

Unable to Create ORACLE-ODBC DSN on Window 7 64 bit using SysWow64/odbcad32.exe

I am trying to create a DSN but I can't do it. The processes I am applying these are as follows:
1. Oracle 12c (64bit) Installed in Remote PC
2. Using Oracle 12c Client on Windows 7 64 bit
3. Trying to Create DSN from Syswow64/odbcad32.exe becuase I want to use this DSN from my Excel 2013 VBA program and the office is 32 bit.
3. After pressing the Add button on the Microsoft ODBC Administrator from Syswow64/odbcad32.exe, I don't find the
Oracle In OracleClient12Home2 in the driver list.
Please suggest me what should I do in this regard.
I have solved this. Basically due to security reason, my registry was not configured properly at the time of installation. I have removed my previous installation and Set new ORACLE_HOME and run install As Run As Administrator. After that the problem is solved.

Connecting to 32 bit Oracle client with 64 bit Excel

I'm trying to connect my Excel to Oracle with this connection string in VBA:
dim cn As New ADODB.Connection
cn.Open "Provider=OraOLEDB.Oracle;Data Source=source;User Id=userid;Password=pwd;"
I'm getting this error:
Run-time error '3706':
Provider cannot be found. It may not be properly installed.
Relevant references:
Microsoft ActiveX Data Objects 6.1 Library
OraOLEDB 1.0 Type Library
Excel is MS Office Professional Plus 2010 64-bit
Windows is 7 Enterprise, service pack 1, 64 bit
Oracle client is 11.2.0 32 bit (I think)
Oracle server is Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
Now... I have scoured the net and cannot figure out what the issue is, but my best guess is there's some 32 bit vs 64 bit conflict with drivers I'm using. I'm trying to get a sense of what path I should be taking before I involve my company's IT department to try installing stuff for me. Does the Oracle client have to be 64 bit if MS Office is? Or do I just need the 64 bit Oracle Data Access Components? I've tried a bunch of different connection strings with no success, including using MSDAORA instead of OraOLEDB.Oracle...
Yes, when you use 64-bit Excel you must install also 64-bit Oracle Client and 64-bit OLE DB Provider.
OLE DB Provider from Microsoft (i.e. MSDAORA) does not exist for 64-bit. It exists only for 32-bit and has been deprecated for very long time already.
I don't know whether you need your 32-bit Oracle Client for something else, so maybe you cannot simply remove it from your PC. Here is an instruction how to install both 32-bit and 64-bit Oracle Client on one machine.
Install Oracle Client x86 and x64
I too had the same issue and the solution is to set the oracle drivers for the excel session to 32 Bit drivers and initiate the excel.
I use the following Bat file to open the excel and it connects to oracle without any issues:
#
Set Temp=C:\Temp
Set TMP=C:\Temp
Set Oracle_Home= #YourDriveLetterhere - >M:\ORA12C\product\12.1.0\client_1
Set Path=C:\Windows;C:\Windows\System32;M:\ORA12C\product\12.1.0\client_1\bin;M:\ORA12C\product\12.1.0\client_1\nls\mesg;M:\ORA12C\product\12.1.0\client_1\network\admin;
START "" "C:\MacroFileNameWhichConnectsToOracle.xlsm"
#
The oracle server matters not.
Try opening a dos window and type c:\ tnsping yourservername
look towards installation issues.

Architecture mismatch exception on connecting Visual Studio to Virtuoso 7.1 via ODBC DSN

I know similar questions have been answered before, but I can't seem to clear my particular problem.
The architecture mismatch exception is prompted when Db-driver and VS-project have different platform targets (32, 64 bit). So far so good.
First thing I tried:
I changed my platform targets for my whole solution to 32 and after that to 64 bit.
-> same error in both cases (I'm not sure under which circumstances VS considers a project to be of a specific architecture, though. Maybe someone can elaborate on this point...)
Now I focused on the driver and DSN for Virtuoso 7.1.
Following the instructions for installing of the open source version of Virtuoso (link), I registered the driver in /lib using 'regsvr32 virtodbc.dll'. This promptly added it as a 32-bit Driver (visible when using the system32/odbcad32.exe). Using this driver in a DSN provided the architecture mismatch.
I tried to register the same dll as a 64 bit driver using the 64 bit version of regsvr32 without success. Since I can not add a suitable 64-bit DSN I would be content in using the 32-bit target cpu. As described the seemingly 32-bit versions of the virtodbc.dll are causing a architecture mismatch under any target platform configuration in VS.
I even installed the Client Connectivity Kit (link) which claim to provide only 64-bit drivers. Only to find out that the automatically installed drivers and DSN are also featuring as 32-bit drivers (meaning: they are only visible when using the 32-bit version of odbcad32.exe and not the 64-bit version)
I'm not sure where the problem lies (VS or Virtuoso drivers) and I would be thankful for your suggestions.
I think, you could try to install 32-bit ODBC driver from Virtuoso 6.4 Client Connectivity Kit.
p.s.
64-bit ODBC app requires 64-bit ODBC driver (and 64-bit ODBC driver manager)
32-bit ODBC app requires 32-bit ODBC driver (and 32-bit ODBC driver manager)
You can not mix them.
I am not quite sure I understand what your problem was or is ?
What is the bit'ness of your Visual Studio installation i.e. 32 or 64 bit ?
system32/odbcad32.exe is the 64bit ODBC Driver Manager despite the "system32" reference, which is a historic folder Microsoft retained from the 32 bit Windows days, placing the actual 32bit binaries on a 64bit system in sysWOW64 folder.
To make things even worse in the last 64bit Visual Studio I used the development environment is actually 32bit and the deployment is 64 bit, requiring a 32 & 64 bit driver for development and deployment, see http://wikis.openlinksw.com/dataspace/owiki/wiki/UdaWikiWeb/MsSqlOn64bitWin
As Virtuoso 7 is only available in 64bit form and the Virtuoso 6 ODBC Drivers (and data access client in general) are compatible with Virtuoso 7 server, you can install the Virtuoso 6 commercial (as Sergei mentioned) or open source (http://bit.ly/1A3mCje) 32 & 64 bit ODBC Drivers and VS should then just work as it has one for development and one for deployment.

What problems do you encounter with VFP apps in a 64 bit environment?

I know that there are issues with the VFP OLEDB provider on 64 bit machines. ... but what issues do you encounter while actually running a VFP application - on a 64 bit machine? Has anyone had any experience in this area?
My first thought was that it would just run as a 32bit app, without making use of the 64 bit power. However, I ran into difficulties with a FoxPro application connecting to a SQL Server database (probably an OLEDB issue as well). Are there other issues as well?
This is somewhat of a specialized scenario, and it may not be related to 64 bitness, but since you asked...
My organization recently hosted a legacy VFP 7 app on a Windows Server 2008 Enterprise 64 bit server for access over Terminal Services. The app runs fine, but there is some kind of bug with the TS Easy Print technology. When you print from the app to a redirected client printer over Easy Print, the top, left, and bottom sides of each page of the document get clipped. The workaround we use is to have the users print to pdfFactory on the server first, then print from pdfFactory to the redirected client printer over Easy Print. Works great.
This is somewhat of a stab in the dark...but I believe there are some drivers with MDAC that aren't available in x64 windows. I think you may be able to install the normal 32-bit MDAC but it will install to the x86 folder.
We've seen zero problems with our VFP9 apps on 64-bit XP, Server 2003, Vista, or Server 2008.
Our print engine is a VB DLL though, so we wouldn't run into any VFP-specific printing issues.

Resources