Power Query and the Oracle Ora-12154 error - excel

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 :)

Related

How to connect Excel to Oracle with PowerQuery

I am trying to connect Excel to my company's Oracle Database. According to the following instructions it should be fairly easy: https://www.wikihow.com/Connect-Excel-to-an-Oracle-Database.
However it has been impossible and quite frustrating so far.
I have followed two different approaches that I've found online.
FIRST APPROACH: installed ODAC from Oracle's Universal Installer
I went to this site https://www.oracle.com/database/technologies/dotnet-odacdev-downloads.html and downloaded the ODAC 12.2.0.1.1 file.
Then, I went through the installation process basically just clicking 'next' on every step.
Note 1: (I don't know if this might be important), in the Database Connection configuration tab I did not fill in any of the information (simply because I didn't know what to put there). It said that if information wasn't filled in, it would not create the TNSNAMES.ORA file.
Note 2: After finishing the installation it says 'run the SQL scripts located in the ... directory after the install'. Which I didn't do, again, because I didn't know how.
After the installation finished a directory was created in the following location: C:\app\client\myUserName\.
The directory goes all the way down to C:\app\client\myUserName\product\12.2.0\client_1, and it contains a bunch of files and folders.
I noticed that no environmental variable was created.
SECOND APPROACH: installed ODBC instant client
I went to this site https://www.oracle.com/database/technologies/instant-client/winx64-64-downloads.html and downloaded both instantclient-basic-windows.x64-19.6.0.0.0dbru.zip and instantclient-odbc-windows.x64-19.6.0.0.0dbru.zip.
Then I created the directory C:\Oracle\instantclient_19_6 and unziped both folders contents into it.
Finally, I ran odbc_install from the command_line, as an administrator, but got Oracle ODBC Driver with same name already exists.
Note: in this case I also noticed that no environmental variable was created.
RESULTS:
When I go to Excel and click on Data\From Database\From Oracle Database I keep getting the same error as before: The recommended provider ('Oracle.DataAccess.Client') is not installed. You can continue with your current provider, however it has been deprecated and may not work properly.".
I was able to solve it by installing the 64 bits version of Oracle's client. Its located at https://www.oracle.com/database/technologies/112010-win64soft.html, file win64_11gR2_client.zip.
Although the message "The recommended provider ('Oracle.DataAccess.Client') is not installed. You can continue with your current provider, however it has been deprecated and may not work properly." remained, I was able to connect after ignoring it.
I have also tried a bunch of approaches and finally got rid of the 'Oracle.DataAccess.Client is not installed' error.
Install Oracle Client for Microsoft Tools:
ODP.NET, Oracle Developer Tools for Visual Studio (Code), and ODAC
https://www.oracle.com/database/technologies/net-downloads.html
Oracle Client for Microsoft Tools installs and configures ODP.NET to support 64-bit Microsoft tool connections with Oracle database. It supports connecting with Power BI Desktop, Power BI service, Excel, SQL Server Analysis Services, SQL Server Data Tools, SQL Server Integration Services, SQL Server Reporting Services, and BizTalk Server.
I have installed Oracle Client for Microsoft Tools 19.17 for (Microsoft Windows x64 (64-bit)) (V1032890-01.exe).
Alternatively, you could follow the learn more link:
Connect Microsoft Tools to Oracle Databases
https://www.oracle.com/database/technologies/appdev/ocmt.html
Tutorials > Power BI Desktop: Connect to Oracle Database
https://www.oracle.com/a/ocom/docs/database/microsoft-powerbi-connection-adw.pdf

Provider cannot be found ADODB error while connecting to Excel 2016 or CSV from Internet Explorer

Background: In our organization, there is a html tool which runs in the Browser(IE11). The tool has a couple of stages and data from each stage is stored in a SharePoint list. In the final stage, all this data needs to be reconciled from a data set which comes from banks in a spreadsheet. Here the tool uses ADODB connection to connect to the Excel file, read the data from it and match with the data on SharePoint.
Problem: Recently after a windows 10 upgrade, the tool stopped exactly on the connection line throwing an error - "Provider cannot be found. It may not be installed correctly". I also got the Microsoft access Database engine re-installed from IT but to no good(this was after reading about answers to my query online)
I am the developer of this tool and it works just fine on my laptop. Below are the specifications of the connection string and other details of software installed
Windows Version: 1511(OS Build 10586. 1176) Windows 10 64 bit
IE: 11
IE version: 11.1176.10586.0
IE Update Version: KB4040685
Office: 2016
Connecting to Excel(version) - 2007-2010 (xls, xlsx format)
Connection Object: ADODB.Connection (via ActiveXObject in JavaScript )
Connection String Parameters
•Provider - Microsoft.ACE.OLEDB.12
•Extended Properties - Excel 8.0 (Also tried Excel 12.0 xml)
•HDR - Yes
•IMEX = 1
OLEDB Drivers installed on the machine: Microsoft ACE 12.0, 16.0 and Jet 4.0
This is the exact same configuration on my laptop and the tool is easily able to connect to Excel or Access also for that purpose.
I have also tried the below, nothing was a success
1.Used Jet.4.0 in the connection string - Here I got error "External table is not in the expected format" & "Unexpected error from database"
2.Tried using ODBC drivers with error - "Data source name not found and no drivers installed"
3.Opened the tool in 32 bit environment
4.Made a HTA app and ran that in 32 bit mode
I also found that in my laptop in the Microsoft Shared folder within program files, there exist Office 14 & 15 folders, but they don't exist in the newer laptops and the same in 32 bit folder of Program files(x86). Would it be possible that having those folders is making the difference?
Please help.
I have learned that installing Microsoft Access Database Engine 2010 (or 2007) on end-user machines fixes the issue, as adodb.dll file is required to be registered on computers using that provider.

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.

attempt to load oracle client libraries threw badimageformatexception

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?

Resources