473,847 Members | 1,758 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 16415
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...@hot mail.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 LINKEDSERVERNAM E...TABLE I get 'Invalid schema or catalog
specified for provider 'MSDASQL'." error. When I try to specify
schema using LINKEDSERVERNAM E.SCHEMA.TABLE I get 'Invalid object name
LINKEDSERVERNAM E.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 LINKEDSERVERNAM E...TABLE I get 'Invalid schema or catalog
specified for provider 'MSDASQL'." error. When I try to specify
schema using LINKEDSERVERNAM E.SCHEMA.TABLE I get 'Invalid object name
LINKEDSERVERNAM E.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****@sommarsk og.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...@sommars kog.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 LINKEDSERVERNAM E...TABLE I get 'Invalid schema or catalog
specified for provider 'MSDASQL'." error. When I try to specify
schema using LINKEDSERVERNAM E.SCHEMA.TABLE I get 'Invalid object name
LINKEDSERVERNAM E.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...@sommarsk og.se

Books Online for SQL Server 2005 athttp://www.microsoft.c om/technet/prodtechnol/sql/2005/downloads/books...
Books Online for SQL Server 2000 athttp://www.microsoft.c om/sql/prodinfo/previousversion s/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.SODE T_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:
LINKEDSERVERNAM E.SCHEMA.TABLE

You need to be able to specify:
LINKEDSERVERNAM E.DATABASE.SCHE MA.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:

LINKEDSERVERNAM E.DATABASE..TAB LE

-- Bill

<mk******@gmail .comwrote in message
news:11******** *************@m 58g2000cwm.goog legroups.com...
On Feb 6, 5:09 pm, "Steve" <morrisz...@hot mail.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 LINKEDSERVERNAM E...TABLE I get 'Invalid schema or catalog
specified for provider 'MSDASQL'." error. When I try to specify
schema using LINKEDSERVERNAM E.SCHEMA.TABLE I get 'Invalid object name
LINKEDSERVERNAM E.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...@dsl extreme.comwrot e:
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:
LINKEDSERVERNAM E.SCHEMA.TABLE

You need to be able to specify:
LINKEDSERVERNAM E.DATABASE.SCHE MA.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:

LINKEDSERVERNAM E.DATABASE..TAB LE

-- Bill

<mkarb...@gmail .comwrote in message

news:11******** *************@m 58g2000cwm.goog legroups.com...
On Feb 6, 5:09 pm, "Steve" <morrisz...@hot mail.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 LINKEDSERVERNAM E...TABLE I get 'Invalid schema or catalog
specified for provider 'MSDASQL'." error. When I try to specify
schema using LINKEDSERVERNAM E.SCHEMA.TABLE I get 'Invalid object name
LINKEDSERVERNAM E.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******** ************@v4 5g2000cwv.googl egroups.com...
On Feb 6, 6:07 pm, Erland Sommarskog <esq...@sommars kog.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 LINKEDSERVERNAM E...TABLE I get 'Invalid schema or catalog
specified for provider 'MSDASQL'." error. When I try to specify
schema using LINKEDSERVERNAM E.SCHEMA.TABLE I get 'Invalid object name
LINKEDSERVERNAM E.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
INKEDSERVERNAM E.SCHEMA.TABLE does not work.

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

--
Erland Sommarskog, SQL Server MVP, esq...@sommarsk og.se

Books Online for SQL Server 2005
athttp://www.microsoft.c om/technet/prodtechnol/sql/2005/downloads/books...
Books Online for SQL Server 2000
athttp://www.microsoft.c om/sql/prodinfo/previousversion s/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.SODE T_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
10910
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 cursor is defined as: SQL_CURSOR delpt_cursor
3
22155
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 application server can talk to the database. I've determined the failure occurs when the the following statement is executed: cstmt.execute(); (due to the failure of println statements placed afterwards). I get the following error after trying to...
3
2142
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 Passing paramters to stored procedure? The datatable holds about 500-700 rows at any given time. If I select one of the approaches the business logic will go into respective layers.With dotnet in picture what would be a good approach
4
4968
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 they are present, making the assumption the database will support the given feature. The problem is I can't find a certain stored procedure in the sysobjects table, even though I know it exists and can see other similar procedures using: select...
7
3546
by: Együd 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 necessary changes on the functions and recreated all my types and functions. It seemd to be all right, but the newly created functions won't work anymore.
3
4616
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 using DBI:ODBC and also have them run successfully. When it comes to stored procedures, I am not sure whether I can do this through DBI::ODBC or not because the many postings that I have read on calling DB2 stored procedures they have all been...
2
1480
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 querying last year's bookings for the period that I'm interested in. This is about 6,500 bookings. The sp then looks at the first booking and compares it to how many cars are already in the car park. If adding that booking would violate the
4
1905
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 from my SP as a result set, but I get an -20213 because the result is from Oracle and not DB2. Can you convert from an Oracle resultset to a DB2 resultset (and how)? Thanks,
2
5467
by: Dino L. | last post by:
How can I run stored procedure (MSSQL) ?
0
9881
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9727
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10645
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10706
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10331
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9480
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7053
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5718
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5909
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.