|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
March 2nd, 2006, 08:27 PM
|
Registered User
|
|
Join Date: Mar 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Executing a query from SQL server to Oracle DB
I'm having trouble querying from my SQL server 2000 db on my local machine to a remote Oracle server 9i.
I can get the server link setup with both MS OLE DB and the Oracle OLE DB drivers and can get a list of tables.
EXEC sp_addlinkedserver
@server = 'DB',
@srvproduct = 'Microsoft OLE DB Provider for Oracle',
@provider = 'MSDAORA',
@datasrc = 'servername',
GO
EXEC sp_addlinkedsrvlogin
@rmtsrvname = 'DB',
@useself = 'false',
@rmtuser = 'login',
@rmtpassword = 'password'
GO
EXEC sp_tables_ex DB
GO
and viola, I get tables upon tables...:D
BUT when I do something simple like this:
SELECT * FROM DB...table where item = something or
SELECT * FROM DB..user.table where item = something
I get this with either OLE DB driver:
Server: Msg 7314, Level 16, State 1, Line 1
OLE DB provider 'DB' does not contain table 'table'. The table either does not exist or the current user does not have permissions on that table.
OLE DB error trace [Non-interface error: OLE DB provider does not contain the table: ProviderName='DB', TableName='table'].
The tables do exist and the login has read-only rights to all tables... I'm totally stumped because the DB genius here sounded extremely relieved when I go the table listing like everything was going to be gravy from there.. any ideas would be amazingly appreciated... am I trying to query wrong? Should I be using some sort of db function or procedure to send the queries to the Oracle DB to get a result on the SQL server. I'm doing some testing for use in a Stored Procedure...
|
March 3rd, 2006, 04:16 PM
|
Registered User
|
|
Join Date: Mar 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks Rich,
Actually, about an hour later I found a post to use openquery through the MSDAORA provider and was able to query the DB properly. But, trying it on my dev box, I am receiving a 7399 error saying the oracle client hasn't been installed, when I am using the msdaora provider.. still stumped, but glad I can query on my personal test machine... : P
|
March 3rd, 2006, 04:26 PM
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
|
|
Sounds like progress. So the OPENQUERY works?! Did you have the Oracle client installed on your personal test machine?
|
March 3rd, 2006, 04:36 PM
|
Registered User
|
|
Join Date: Mar 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Yes, *much* progress. The only thing keeping me from getting this into QA is knowing what to install on the QA machines for the link to function correctly.
I have so much crap installed on this machine, I don't know what's not allowing me to make the connection with MSDAORA, since it is a MS provider. I do have the oracle 10g dev suite installed on my machine.
I tried installing the Oracle provider for OLE DB on a dev machine(win2k3 server) that I have access to, but still got the error. I even setup the net config. I tried to switch to the Oracle provider, but now the enterprise manager hangs when I try to view the server. Not good...
|
March 3rd, 2006, 06:05 PM
|
Registered User
|
|
Join Date: Mar 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Server: Msg 7399, Level 16, State 1, Procedure sp_tables_ex, Line 13
OLE DB provider 'MSDAORA' reported an error.
[OLE/DB provider returned message: Oracle client and networking components were not found. These components are supplied by Oracle Corporation and are part of the Oracle Version 7.3.3 or later client software installation.
Provider is unable to function until these components are installed.]
OLE DB error trace [OLE/DB Provider 'MSDAORA' IDBInitialize::Initialize returned 0x80004005: ].
|
March 3rd, 2006, 07:45 PM
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
|
|
Hmmmm.. You said you installed them right? Is your test box a server too? Could just need to uninstall and reinstall the client on the server. I don't know really. Just fishing. Are you running these tests in QA while logged on locally to both boxes? Sorry if this is a distraction to you since I don't really have THE answer.
|
March 24th, 2006, 08:15 AM
|
Registered User
|
|
Join Date: Mar 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
On the Error:
OLE DB provider 'MSDAORA' reported an error.
[OLE/DB provider returned message: Oracle client and networking components were not found. These components are supplied by Oracle Corporation and are part of the Oracle Version 7.3.3 or later client software installation.
I got the error (using client 10g), and was finally able to fix it by changing the following registry keys to the values indicated:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDTC\MTxOCI]
"OracleXaLib"="oraclient10.dll"
"OracleSqlLib"="orasql10.dll"
"OracleOciLib"="oci.dll"
These were set to some old values (probably for Oracle client 8 which was there on my machine earlier).
Hope this helps..
|
|
|