Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

catastrophic failure trying to select from linked server

I have created a linked oledb/odbc connection to Pervasive SQL from SQL SERVER 2012:

USE [master]
GO

/****** Object:  LinkedServer [KSLAP208]    Script Date: 2/8/2013 10:38:55 AM ******/
EXEC master.dbo.sp_addlinkedserver @server = N'KSLAP208', @srvproduct=N'Pervasive ODBC Interface', @provider=N'MSDASQL', @datasrc=N'C003', @location=N'localhost'
 /* For security reasons the linked server remote logins password is changed with ######## */
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'KSLAP208',@useself=N'False',@locallogin=NULL,@rmtuser=NULL,@rmtpassword=NULL

GO

EXEC master.dbo.sp_serveroption @server=N'KSLAP208', @optname=N'collation compatible', @optvalue=N'false'
GO

EXEC master.dbo.sp_serveroption @server=N'KSLAP208', @optname=N'data access', @optvalue=N'true'
GO

EXEC master.dbo.sp_serveroption @server=N'KSLAP208', @optname=N'dist', @optvalue=N'false'
GO

EXEC master.dbo.sp_serveroption @server=N'KSLAP208', @optname=N'pub', @optvalue=N'false'
GO

EXEC master.dbo.sp_serveroption @server=N'KSLAP208', @optname=N'rpc', @optvalue=N'false'
GO

EXEC master.dbo.sp_serveroption @server=N'KSLAP208', @optname=N'rpc out', @optvalue=N'false'
GO

EXEC master.dbo.sp_serveroption @server=N'KSLAP208', @optname=N'sub', @optvalue=N'false'
GO

EXEC master.dbo.sp_serveroption @server=N'KSLAP208', @optname=N'connect timeout', @optvalue=N'0'
GO

EXEC master.dbo.sp_serveroption @server=N'KSLAP208', @optname=N'collation name', @optvalue=null
GO

EXEC master.dbo.sp_serveroption @server=N'KSLAP208', @optname=N'lazy schema validation', @optvalue=N'false'
GO

EXEC master.dbo.sp_serveroption @server=N'KSLAP208', @optname=N'query timeout', @optvalue=N'0'
GO

EXEC master.dbo.sp_serveroption @server=N'KSLAP208', @optname=N'use remote collation', @optvalue=N'true'
GO

EXEC master.dbo.sp_serveroption @server=N'KSLAP208', @optname=N'remote proc transaction promotion', @optvalue=N'true'
GO

Test Connection is succesful.

However, when I try to select from a database:

select * from [KSLAP208].[C003]..PA_Profile_BASE_1119 

I immdiately get just the field names returned and then immediately after that I get this error:

Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "MSDASQL" for linked server "KSLAP208" reported an error. The provider reported an unexpected catastrophic failure.
Msg 7330, Level 16, State 2, Line 1
Cannot fetch a row from OLE DB provider "MSDASQL" for linked server "KSLAP208".

What am I doing wrong? Why Can I not select? I am able to see all the databases and tables on the linnked server.

if I select a small amount of data select field1,field2 it works without problems.

like image 352
Alex Gordon Avatar asked Feb 08 '13 18:02

Alex Gordon


People also ask

What is catastrophic failure in computer?

Catastrophic failure is a complete, sudden, often unexpected breakdown in a machine, electronic system, computer or network. Such a breakdown may occur as a result of a hardware event such as a disk drive crash, memory chip failure or surge on the power line.

What is Openquery?

The OPENQUERY function is an ad-hoc method to access the data of a remote server. If you are querying the remote server frequently, then instead of using it, you should use the linked server.


1 Answers

I think I remember this being an issue when I created a postgresql linked server. I think you may need to recreate the linked server with this set to false (or just change it in the linked server properties->server options):

EXEC master.dbo.sp_serveroption @server=N'KSLAP208', 
    @optname=N'remote proc transaction promotion', @optvalue=N'false'

Additionally, try using OPENQUERY to run this against the link

SELECT * 
FROM OPENQUERY(KSLAP208,'SELECT * FROM PA_Profile_BASE_1119');
like image 119
swasheck Avatar answered Sep 23 '22 08:09

swasheck