ORA-12560 Attempting to Query the Oracle Database From Microsoft SQL Server's SQL Query Analyzer Using the Oracle Provider for OLE DB

(Doc ID 260775.1)

Last updated on JULY 05, 2017

Applies to:

Oracle Provider for OLE DB - Version and later
Microsoft Windows (32-bit)
***Checked for relevance on 10-Oct-2013***


You are using Microsoft's SQL Server to retrieve information from Oracle using SQL Server's "OpenRowset" Transact-SQL function in SQL Query Analyzer.  You are using the Oracle Provider for OLE DB to connect to Oracle.  You are attempting to execute the following SELECT statement:

     SELECT * FROM OpenRowset('OraOLEDB.Oracle','orcl';'scott';'tiger',SCOTT.EMP) WHERE ename='MILLER' AND sal>0

and receive one of the these errors:

     Server: Msg 7320, Level 16, State 2, Line 3
     Could not execute query against OLE DB provider 'OraOLEDB.Oracle'.
     OLE DB error trace [OLE/DB Provider 'OraOLEDB.Oracle' ICommandText::Execute
       returned 0x80040155].


     Server: Msg 7399, Level 16, State 1, Line 1
     OLE DB provider 'ORAOLEDB.Oracle' reported an error.  
     [OLE/DB provider returned message: ORA-12560: TNS:protocol adapter error]
     OLE DB error trace [OLE/DB Provider 'ORAOLEDB.Oracle'
       IDBInitialize::Initialize returned 0x80004005:   ].

The query works when executed through SQL Server's Linked Server in the following form:

     SELECT * FROM [linked_server_name]..[SCOTT].[EMP] WHERE ename='MILLER' AND sal>0


Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms