Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing linked server

Status
Not open for further replies.

par60056

Programmer
Jul 16, 2001
31
0
0
US
I have an Oracle server that I am trying to link to and access from SQL Server 7.

I can access the Oracle server using the Oracle sqlplus command "sqlplus user/passwd@server" and "select field from schema.table"

In SQL Server osql I issued the following:
sp_addlinkedserver @server = 'myOServer', @srvproduct = 'Oracle',
@provider='MSDAORA', @datasrc='server'

sp_addlinkedsrvlogin 'myOServer', 'false', 'sa', 'user', 'passwd'


I cannot seem to find the right format for referencing the tables in the Oracle server. If in the osql I try:
select field from myOserver.schema..table
or
select field from myOserver.schema.sa.table
or
select field from myOserver.schema.user.table

I get the message "[OLE/DB provider returned message: Oracle error occurred, but error message could not be retrieved from Oracle.]"

Anybody have any help?

Peter Richardson
 
I think you need to use the OPENQUERY statement with your linked server. Not sure, never messed with Oracle, but when I set up a linked server to Active Directory, I have to use OPENQUERY.

Hope this helps.
 
Hi

This will allow you to run queries against oracle

select * from OPENQUERY(myOServer, "select * from table")

You have to use double quotes around the select within the OPENQUERY statement.

Another thing I'm not sure if you will be able to access the oracle server even though the linked server is setup. We have numerous linked servers from SQL 2000 to Oracle, SQL 2000 to SQL 7, SQL 2000 to SQL 6.5 but we can't get SQL 7 to Oracle to work.

Hope this helps

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top