472,374 Members | 1,239 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,374 software developers and data experts.

Stored Procedure querying another database

Hello,

I need to come up with a stored procedure that will allow me to read
data from another database. The database I need to read the data from
is a UniData residing on a Unix server. The stored procedure needs to
reside on my sql 2005 server. The task is very simple in Access as we
have ODBC connections set up to the UniData via Informix (or IBM)
UniData ODBC drivers. I can easily combine my UniData and Sql Server
tables from within access. However, I can't seem to find a way to
replicate the same behavior in MS SQL Stored Procedure without the use
of Access. Is that even possible?

Thanks,

Marek

Feb 6 '07 #1
7 16287
On Feb 6, 1:25 pm, "mkarb...@gmail.com" <mkarb...@gmail.comwrote:
Hello,

I need to come up with a stored procedure that will allow me to read
data from another database. The database I need to read the data from
is a UniData residing on a Unix server. The stored procedure needs to
reside on my sql 2005 server. The task is very simple in Access as we
have ODBC connections set up to the UniData via Informix (or IBM)
UniData ODBC drivers. I can easily combine my UniData and Sql Server
tables from within access. However, I can't seem to find a way to
replicate the same behavior in MS SQL Stored Procedure without the use
of Access. Is that even possible?

Thanks,

Marek
Linked server or OPENROWSET
In SQL Server 2005 Books Online see the topic: Distributed Queries

Feb 6 '07 #2
On Feb 6, 5:09 pm, "Steve" <morrisz...@hotmail.comwrote:
On Feb 6, 1:25 pm, "mkarb...@gmail.com" <mkarb...@gmail.comwrote:
Hello,
I need to come up with a stored procedure that will allow me to read
data from another database. The database I need to read the data from
is a UniData residing on a Unix server. The stored procedure needs to
reside on my sql 2005 server. The task is very simple in Access as we
have ODBC connections set up to the UniData via Informix (or IBM)
UniData ODBC drivers. I can easily combine my UniData and Sql Server
tables from within access. However, I can't seem to find a way to
replicate the same behavior in MS SQL Stored Procedure without the use
of Access. Is that even possible?
Thanks,
Marek

Linked server or OPENROWSET
In SQL Server 2005 Books Online see the topic: Distributed Queries
I started playing around with the linked server and I got it to the
point where I can see the tables from UniData, but when I try to query
it using LINKEDSERVERNAME...TABLE I get 'Invalid schema or catalog
specified for provider 'MSDASQL'." error. When I try to specify
schema using LINKEDSERVERNAME.SCHEMA.TABLE I get 'Invalid object name
LINKEDSERVERNAME.SCHEMA.TABLE'; do you know why these errors occur
and how to get around them?

Feb 6 '07 #3
mk******@gmail.com (mk******@gmail.com) writes:
I started playing around with the linked server and I got it to the
point where I can see the tables from UniData, but when I try to query
it using LINKEDSERVERNAME...TABLE I get 'Invalid schema or catalog
specified for provider 'MSDASQL'." error. When I try to specify
schema using LINKEDSERVERNAME.SCHEMA.TABLE I get 'Invalid object name
LINKEDSERVERNAME.SCHEMA.TABLE'; do you know why these errors occur
and how to get around them?
To refer to an object on a remote server, you must use four-part
notation: server.catalog.schema.table. So that's why
INKEDSERVERNAME.SCHEMA.TABLE does not work.

Unfortunately, I have no idea what will work, since I've never heard of
Unidata before.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Feb 6 '07 #4
On Feb 6, 6:07 pm, Erland Sommarskog <esq...@sommarskog.sewrote:
mkarb...@gmail.com (mkarb...@gmail.com) writes:
I started playing around with the linked server and I got it to the
point where I can see the tables from UniData, but when I try to query
it using LINKEDSERVERNAME...TABLE I get 'Invalid schema or catalog
specified for provider 'MSDASQL'." error. When I try to specify
schema using LINKEDSERVERNAME.SCHEMA.TABLE I get 'Invalid object name
LINKEDSERVERNAME.SCHEMA.TABLE'; do you know why these errors occur
and how to get around them?

To refer to an object on a remote server, you must use four-part
notation: server.catalog.schema.table. So that's why
INKEDSERVERNAME.SCHEMA.TABLE does not work.

Unfortunately, I have no idea what will work, since I've never heard of
Unidata before.

--
Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se

Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
Books Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
I started using the 4 part query and I guess I got a step further;
now I'm getting a different error:

the query is: SELECT * FROM AVLIVE..ii.SODET_NF

the error:
[OLE/DB provider returned message: Unspecified error]
[OLE/DB provider returned message: [Ardent][UniData ODBC
Driver]Invalid column number.]
OLE DB error trace [OLE/DB Provider 'MSDASQL'
IDBSchemaRowset::GetRowset returned 0x80004005: ].
Msg 7399, Level 16, State 1, Line 1
OLE DB provider 'MSDASQL' reported an error.

Any idea what this error means?

Feb 6 '07 #5
Marek,

In order to use a linked server, the server has to be capable of a four part
namespace. Your example was only showing a three part namespace.

You were using:
LINKEDSERVERNAME.SCHEMA.TABLE

You need to be able to specify:
LINKEDSERVERNAME.DATABASE.SCHEMA.TABLE

Do the ODBC drivers and databases you are using support a four-part name. If
they don't, then you will have to use OPENROWSET.

I don't know about SQL 2005, but in SQL 2K you can not inherit any part of
the namespace if the database is on a different server. The following won't
work:

LINKEDSERVERNAME.DATABASE..TABLE

-- Bill

<mk******@gmail.comwrote in message
news:11*********************@m58g2000cwm.googlegro ups.com...
On Feb 6, 5:09 pm, "Steve" <morrisz...@hotmail.comwrote:
>On Feb 6, 1:25 pm, "mkarb...@gmail.com" <mkarb...@gmail.comwrote:
Hello,
I need to come up with a stored procedure that will allow me to read
data from another database. The database I need to read the data from
is a UniData residing on a Unix server. The stored procedure needs to
reside on my sql 2005 server. The task is very simple in Access as we
have ODBC connections set up to the UniData via Informix (or IBM)
UniData ODBC drivers. I can easily combine my UniData and Sql Server
tables from within access. However, I can't seem to find a way to
replicate the same behavior in MS SQL Stored Procedure without the use
of Access. Is that even possible?
Thanks,
Marek

Linked server or OPENROWSET
In SQL Server 2005 Books Online see the topic: Distributed Queries

I started playing around with the linked server and I got it to the
point where I can see the tables from UniData, but when I try to query
it using LINKEDSERVERNAME...TABLE I get 'Invalid schema or catalog
specified for provider 'MSDASQL'." error. When I try to specify
schema using LINKEDSERVERNAME.SCHEMA.TABLE I get 'Invalid object name
LINKEDSERVERNAME.SCHEMA.TABLE'; do you know why these errors occur
and how to get around them?

Feb 6 '07 #6
On Feb 6, 6:18 pm, "AlterEgo" <altereg...@dslextreme.comwrote:
Marek,

In order to use a linked server, the server has to be capable of a four part
namespace. Your example was only showing a three part namespace.

You were using:
LINKEDSERVERNAME.SCHEMA.TABLE

You need to be able to specify:
LINKEDSERVERNAME.DATABASE.SCHEMA.TABLE

Do the ODBC drivers and databases you are using support a four-part name. If
they don't, then you will have to use OPENROWSET.

I don't know about SQL 2005, but in SQL 2K you can not inherit any part of
the namespace if the database is on a different server. The following won't
work:

LINKEDSERVERNAME.DATABASE..TABLE

-- Bill

<mkarb...@gmail.comwrote in message

news:11*********************@m58g2000cwm.googlegro ups.com...
On Feb 6, 5:09 pm, "Steve" <morrisz...@hotmail.comwrote:
On Feb 6, 1:25 pm, "mkarb...@gmail.com" <mkarb...@gmail.comwrote:
Hello,
I need to come up with a stored procedure that will allow me to read
data from another database. The database I need to read the data from
is a UniData residing on a Unix server. The stored procedure needs to
reside on my sql 2005 server. The task is very simple in Access as we
have ODBC connections set up to the UniData via Informix (or IBM)
UniData ODBC drivers. I can easily combine my UniData and Sql Server
tables from within access. However, I can't seem to find a way to
replicate the same behavior in MS SQL Stored Procedure without the use
of Access. Is that even possible?
Thanks,
Marek
Linked server or OPENROWSET
In SQL Server 2005 Books Online see the topic: Distributed Queries
I started playing around with the linked server and I got it to the
point where I can see the tables from UniData, but when I try to query
it using LINKEDSERVERNAME...TABLE I get 'Invalid schema or catalog
specified for provider 'MSDASQL'." error. When I try to specify
schema using LINKEDSERVERNAME.SCHEMA.TABLE I get 'Invalid object name
LINKEDSERVERNAME.SCHEMA.TABLE'; do you know why these errors occur
and how to get around them?- Hide quoted text -

- Show quoted text -
thanks for all your help; indeed with OPENROWSET I was able to get
the query working with no problems (or at least the problems I'm
having are not related to the tables, rather with Error converting
data type DBTYPE_DBDATE to datetime, but that's a topic for another
thread if I can't figure it out)

Feb 7 '07 #7
marek,

You can't use inherited names. In other words, don't put two periods
together. See my other post.

-- Bill

<mk******@gmail.comwrote in message
news:11********************@v45g2000cwv.googlegrou ps.com...
On Feb 6, 6:07 pm, Erland Sommarskog <esq...@sommarskog.sewrote:
>mkarb...@gmail.com (mkarb...@gmail.com) writes:
I started playing around with the linked server and I got it to the
point where I can see the tables from UniData, but when I try to query
it using LINKEDSERVERNAME...TABLE I get 'Invalid schema or catalog
specified for provider 'MSDASQL'." error. When I try to specify
schema using LINKEDSERVERNAME.SCHEMA.TABLE I get 'Invalid object name
LINKEDSERVERNAME.SCHEMA.TABLE'; do you know why these errors occur
and how to get around them?

To refer to an object on a remote server, you must use four-part
notation: server.catalog.schema.table. So that's why
INKEDSERVERNAME.SCHEMA.TABLE does not work.

Unfortunately, I have no idea what will work, since I've never heard of
Unidata before.

--
Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se

Books Online for SQL Server 2005
athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
Books Online for SQL Server 2000
athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

I started using the 4 part query and I guess I got a step further;
now I'm getting a different error:

the query is: SELECT * FROM AVLIVE..ii.SODET_NF

the error:
[OLE/DB provider returned message: Unspecified error]
[OLE/DB provider returned message: [Ardent][UniData ODBC
Driver]Invalid column number.]
OLE DB error trace [OLE/DB Provider 'MSDASQL'
IDBSchemaRowset::GetRowset returned 0x80004005: ].
Msg 7399, Level 16, State 1, Line 1
OLE DB provider 'MSDASQL' reported an error.

Any idea what this error means?

Feb 7 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Michael Trosen | last post by:
Hi Everyone, I hope someone can help, I'm pretty new to pro*c programming. I have the following application setup: a pro*c program calls a stored procedure and recieves a cursor back: the...
3
by: dinesh prasad | last post by:
I'm trying to use a servlet to process a form, then send that data to an SQL server stored procedure. I'm using the WebLogic 8 App. server. I am able to retrieve database information, so I know my...
3
by: nandan | last post by:
Hi, Has any one ever compared the performance of calling a DataTable's Select method with a stored procedure doing the same thing? My point is: dataRows = DataTable.Select(filter) is better or...
4
by: Robin Tucker | last post by:
Hi, I'm trying to determine with my program whether or not a given database supports a given feature set. To do this I'm querying for certain stored procedures in the sysobjects table and if...
7
by: Egyd Csaba | last post by:
Hi, I've a problem with some of my stored procs. My config is: RH7.1, Postgres 7.3.2 I had converted a few fields of a few tables from one type to another and after this I made all the...
3
by: Samarth | last post by:
Folks, I am calling a DB2 stored procedure through Perl using the DBI:ODBC module. I am not sure if I can do this or not because I have been able to connect to and also issue select statements...
2
by: James Foreman | last post by:
I'm building a stored procedure that simulates cars arriving in a car park, and staying for different amounts of time, based on historical data. So, first I define a cursor that's populated by...
4
by: dougjrs | last post by:
Good Afternoon, I have a Java stored procedure on DB2 z/OS and it is using the Type 4 JDBC driver to access an Oracle database. After I get the data from the Oracle dataabse I try to return it...
2
by: Dino L. | last post by:
How can I run stored procedure (MSSQL) ?
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...
0
by: F22F35 | last post by:
I am a newbie to Access (most programming for that matter). I need help in creating an Access database that keeps the history of each user in a database. For example, a user might have lesson 1 sent...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.