Connecting to 32 bit Oracle client with 64 bit Excel - 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.

Related

Excel Connect to Oracle 12c Using VBA

Trying connect to an Oracle Database 12c Enterprise Edition 64-bit with Excel VBA.
The client machine has the following 32-bit drivers installed:
Microsoft ODBC for Oracle
Oracle in OraClient11g_home1
Oracle in OraClient12Home1_32bit
And the following 64-bit drivers installed:
Oracle in OraClient11g_home1
Oracle in OraClient12Home1
The file has the following reference:
Microsoft ActiveX Data Objects 6.1 Library
I've tried multiple formats of the connection string but nothing works.
'This gave the error "[Oracle][ODBC][Ora]ORA-12560: TNS:protocol adapter error"
cs = "Driver={Oracle in OraClient12Home1}; UID=myuid; PWD=mypwd; SERVER=myhostname/myservicename;"
'This gave the error "[Oracle][ODBC][Ora]ORA-12154: TNS:could not resolve the connect identifier specified"
cs = "Driver={Oracle in OraClient12Home1}; UID=myuid; PWD=mypwd; SERVER=myhostname; DBQ=myservicename;"
'This gave the error "[Oracle][ODBC][Ora]ORA-12560: TNS:protocol adapter error"
cs = "Driver={Oracle in OraClient12Home1}; CONNECTSTRING=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=myhostname)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=myservicename)));UID=myuid; PWD=mypwd;"
'This would crash Excel
cs = "Driver={Oracle in OraClient11g_home1}; CONNECTSTRING=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=myhostname)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=myservicename)));UID=myuid; PWD=mypwd;"
I've also tried variations using the following drivers in the connection string
Microsoft ODBC for Oracle
OraOLEDB.Oracle
Oracle in OraClient12Home1
Thanks for your help everyone and sorry for the delayed response (had multiple work related "fires" I was putting out).
Anyway... I found a solution that worked for me. I don't think the problem was having multiple drivers on the same machine because I'm now able to connect without changing anything except the connection string method I used.
While I'm still not sure why the "driver" method of my connection string didn't work, I was able to use a "provider" based connection string and that worked.
'Using OraOLEDB.Oracle.1.
cs = "Provider=OraOLEDB.Oracle.1;User ID=myuid;Password=mypwd;Data Source=myhostname/myservicename;"
'Using OraOLEDB.Oracle.
cs = "Provider=OraOLEDB.Oracle;User ID=myuid;Password=mypwd;Data Source=myhostname/myservicename;"
'Using OraOLEDB.Oracle as a TNS-less connection string.
cs = "Provider=OraOLEDB.Oracle;Data Source=(DESCRIPTION=(CID=GTU_APP)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=myhostname)(PORT=myport)))(CONNECT_DATA=(SERVICE_NAME=myservicename)(SERVER=DEDICATED)));User Id=myuid;Password=mypwd;"
'Using variation of the above with a port included.
cs = "Provider=OraOLEDB.Oracle.1;User ID=myuid;Password=mypwd;Data Source=myhostname:myport/myservicename;"
I think it is a bad idea to have more than one version of Oracle Client installed, i.e. one 32-bit and one 64-bit.
For OLE DB (i..e "OraOLEDB.Oracle") it is even not possible to have more than one version due to limitation of COM where it is based on (unless you would register the DLL every time before you run an application).
In general you can use either ODBC or OLE DB, both should work.
The most important point is: the architecture (i.e. 32-bit or 64-bit) of your Excel must be the same as the architecture of your Oracle driver! The architecture of your database does not matter.
ODBC and OLE DB drivers are provided by Microsoft ("Microsoft ODBC for Oracle" and "MSDAO") and by Oracle (e.g. "Oracle in OraClient12Home1" and "OraOLEDB.Oracle")
The Microsoft drivers are old and deprecated, you should prefer the drivers from Oracle. Microsoft drivers exist only for 32-bit, so if your Excel is 64-bit then you are even forced to use the Oracle drivers.
Another note, the version of Oracle drivers (ODBC and OLE DB) has to be the same as the version of your Oracle client, most likely you messed it up when you installed three different Oracle clients.
In case you need to install 32-bit and 64-bit client, follow this instruction: BadImageFormatException. This will occur when running in 64 bit mode with the 32 bit Oracle client components installed

ActiveX component can’t create object : PCOMM.autECLConnList

I am trying to automate the sending keystrokes to a mainframe application which is being connected using PCOMM iSeries emulator. I am not sure on what I am doing wrong here, as the same code works on a different machine.
Below are the configurations,
Working Machine : Windows 10 64 bit, Office 32-Bit
Error Machine : Windows 7 64 bit, Office 64-Bit
Below is the code
On Error Resume Next
Set autECLWinObj = CreateObject("PCOMM.autECLConnList")
Set IA = CreateObject("PCOMM.autECLOIA")
Set PS = CreateObject("PCOMM.autECLPS")
PS.SetConnectionByName (Client)
IA.SetConnectionByName (Client)
autECLWinObj.SetConnectionByName (Client)
Please help, i am new to this and stuck .
P.S : Kindly don't duplicate the question as there are none specific to PCOMM.
Changed MS Office 64 to MS Office 32 and it worked.
PCOMM only provides 32-bit dlls for the automation objects, so those can not be used from a 64-bit process (like 64-bit office).
See also this IBM support entry.
You must upgrade you IBM Personal Communications to the new Version 14 (64 bits) since may 2019

32-bit and 64-bit Office on the same pc - trouble with MS access database driver

I received an error while trying to execute an MS SSIS package that contained Excel source:
"The Microsoft.ACE.OLEDB.12.0 provider is not registered on the local machine".
While trying to install MS Access Database driver 64-bit, and then MS Access Database driver 32-bit, I get two conflicting errors:
"You cannot install the 64 bit version of Microsoft Access Database Engine because you have 32 bit Office Products installed"
and
"You cannot install the 32 bit version of Microsoft Access Database Engine because you have 64 bit Office Products installed"
I guess that on my pc 32-bit and 64-bit versions of office are running.
The interesting thing though is that I see that only MS office 2010 and MS office Viewer 2003 are installed on my machine and the latter through a 2007 compatibility package.
So, my question is probably two fold:
Is running the driver the proper way to solve my initial problem?
How can I overcome the situation where neither a 32-bit nor a 64-bit can be installed because there exist both 32-bit and 64-bit office versions on my pc.
Please keep in mind that I am not sure what should I uninstall. Office 2010 and MS windows viewer 2003 are running on my pc.
I came across the same conflicting error messages when installing the Access Database Engine.
Since I new I had installed a 32bit office, I installed the 32bit version of Access Database Engine with this command:
.\AccessDatabaseEngine.exe /quiet
I found this trick here: https://blogs.msdn.microsoft.com/dataaccesstechnologies/2017/10/18/unexpected-error-from-external-database-driver-1-microsoft-jet-database-engine-after-applying-october-security-updates/
By the way, in my case one of the two error messages was also mentioning that I had installed the click to run extensibility component 64-bit registration.
only one version 32/64bit of Microsoft Access Database Engine 2010 Redistributable can be installed.
Download it from this link https://www.microsoft.com/en-us/download/details.aspx?id=13255

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.

Excel ODBC and 64 bit server

using ASP.NET I need to update an excel template.
Our server is running Windows 2008 in 64 bit mode.
I am using the following code to access the excel file:
...
string connection =
#"Provider=MSDASQL;Driver={Microsoft Excel Driver (*.xls)};DBQ=" + path + ";";
...
IF the application pool is set to Enable 32 bit applications the code works as expected; however the oracle driver I am using fails as it is only 64 bit.
If Enable 32-bit applications is set to false the excel code fails with the error:
Data source name not found and no
default driver specified
Any suggestions?
The Microsoft Office team has just released a 64-bit driver
Microsoft release a 64bit OLEDB FOR ODBC in 2008/04/04
http://www.microsoft.com/downloads/details.aspx?FamilyID=000364db-5e8b-44a8-b9be-ca44d18b059b&DisplayLang=en
Now you should able to run everything 64bit, can u try it and let us know the result and personally I think Microsoft should release a 64bit Jet Oledb 4.0, if the development team has no time to do it then just put it in codeplex.com and let other programmers do it.
There is also 2010 Office System Driver Beta: Data Connectivity Components
Link which has allowed us to open Excel 2007 (XLS) from a 64bit environment.
This download will install a set of components that can be used by non-Microsoft Office applications to read data from Microsoft Office 2010 Beta files
Our connection string
#"Provider=Microsoft.ACE.OLEDB.12.0;Data Source= " + filePath + ";Extended Properties=\"Excel 12.0;HDR=YES;\""
There are no office drivers for 64bit released.
The (currently) last post at this link:
MSDN Forum details a cumbersome and ugly workaround. You could also replace the Windows Service with a COM exposed assembly, if you wish. Still ugly though. :)
Install the 32-bit Oracle driver and enable 32 bit applications?

Resources