1

I am facing the issue while querying the ORACLE database from linked server.

The error message which I get is:

An error occurred while preparing the query

SELECT COUNT(*) FROM OracleDBInstance.testTable for execution against OLE DB provider ADsDSOObject for linked server lnk_server.

My query is:

select * from openquery(lnk_server,'SELECT COUNT(*) FROM OracleDBInstance.testTable')

I have searched a lot, but everyone is providing solution for Active Directory query.

Can any one provide the correct solution?

1
  • 2
    Why you want to use "Microsoft OLE DB Provider for Microsoft Active Directory Service" provider to query Oracle? You have to install proper OLEDB or ODBC driver for Oracle. Commented Jun 12, 2015 at 6:57

1 Answer 1

0

I had the same problem

In some cases when using the SSMS interface to create a linked server using Oracle Provider for OLE DB, in the background it instead uses ADsDSOObject.

To resolve the issue I followed these steps:

  1. Create the linked server using Oracle Provider for OLE DB
  2. Right click the new linked server, select Script Linked Server As -> CREATE To -> New Query Editor Window
  3. Delete the existing linked server
  4. Change the generated query. change @provider from ADsDSOObject to N'OraOLEDB.Oracle
  5. Run the query

This worked for me to use OraOLEDB.Oracle rather than ADsDsOObject.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.