is it possible to use a provider from a different server? - sql

I may have figured out why I cannot establish a linked server on sql server 2012 using ODBC/OLEDB into a pervasive sql.
I have another sql server 2005 that is able to connect to the pervasive sql because it has a provider called PervasiveOLEDB.11.0.
I would like to use the same provider, and I am wondering if it is possible to get my sql server 2012 to use this provider (which resides on a different server)?\
If not, would there be a different way I could export/import this provider?
I am trying to establish a connection this way, but cannot do it with the provider:
EXEC sp_addlinkedserver
#server = 'kslap208',
#provider = 'MSDASQL',
#datasrc = 'C003',
#srvproduct = 'Pervasive'
GO
update:
although i am able to connect succesfully, i am getting this error when i try to select from tables:
OLE DB provider "MSDASQL" for linked server "kslap208" returned message "Unspecified error".
OLE DB provider "MSDASQL" for linked server "kslap208" returned message "[Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC Engine Interface][Data Record Manager]Cannot locate the named database you specified(Btrieve Error 2301)".
Msg 7311, Level 16, State 2, Line 1
Cannot obtain the schema rowset "DBSCHEMA_TABLES" for OLE DB provider "MSDASQL" for linked server "kslap208". The provider supports the interface, but returns a failure code when it is used.

I think you need to download Pervasive SQL 11 client from here. This should install all drivers

Related

Connect to SQL Azure DB using OpenRowSet from on-premise SQL Server

I am trying to connect to SQL Azure database from an on-premise SQL Server using openrowset, but it is failing with an error.
My query is
SELECT a.*
FROM OPENROWSET('SQLNCLI', 'Server=sqlazureserver.database.windows.net;Database=dbname;User ID=username;Password=password;Connection Timeout=30;', 'select * from [dbo].[tablename]') AS a;
and the error I get:
Msg 7399, Level 16, State 1, Line 11
The OLE DB provider "SQLNCLI11" for linked server "(null)" reported an error. Authentication failed.
Msg 7303, Level 16, State 1, Line 11
Cannot initialize the data source object of OLE DB provider "SQLNCLI11" for linked server "(null)".
I am able to successfully connect using linked server, but I do not want to go that route as my connection strings will be dynamic.
From documentation ,I could see open row set is not supported against SQL Azure database as of now.
Instead of openrowset,you can use distributed queries to accomplish the same
exec ('select * from table') at linkedserver

Trying to import large data from Oracle using a Linked Server on MS SQL 2005

I'm trying to import large amount of data from an Oracle database using a Linked Server on MS SQL 2005.
Here's the OPENQUERY command.
SELECT * from OPENQUERY(HRDEV9,
'SELECT EMPLOYEE_ID
,EMPLOYEE_NAME
,TO_CHAR(BIRTHDATE,''yyyy-mm-dd'') AS BIRTHDATE
FROM SYSADM.PS_EMPLOYEES')
I have not included all the columns for the sake of keeping my example simple, I have around 180 columns and 75000 rows to import.
This is the error I'm getting when I execute the query:
OLE DB provider "OraOLEDB.Oracle" for linked server "HRDEV9" returned
message "Not enough storage is available to complete this operation.".
Msg 7399, Level 16, State 1, Line 1 The OLE DB provider
"OraOLEDB.Oracle" for linked server "HRDEV9" reported an error. The
provider ran out of memory.
Msg 7372, Level 16, State 4, Line 1 Cannot
get properties from OLE DB provider "OraOLEDB.Oracle" for linked
server "HRDEV9".
I have enabled autogrowth, and set the unrestricted file growth for both Data and Log files.
I have tried importing only 10 rows with the Oracle ROWNUM but still getting the same error.
Thank you for your time.
Try importing data from Oracle into CSV and then load it into MS SQL.
Sorry for pointing you to my blog, but here is how to get data fast from Oracle.
I'm posting this to help others with the same issue.
Apparently this is a bug confirmed by Microsoft. The error message occurs if the linked table contains a column of type NUMERIC.
The workaround is to re-create the linked server to use the Microsoft OLE DB Provider for ODBC (MSDASQL).
Here are two ways you can work around the behavior:
Use the ODBC driver for ORACLE that is provided by Microsoft:
EXEC sp_addlinkedserver #server = 'ORACLEODBC', #srvproduct = 'MSDASQL', #provider = 'MSDASQL',
#provstr = 'DRIVER={Microsoft ODBC for Oracle};SERVER=MyOracleServer;UID=USERNAME;PWD=Password;'
go
sp_addlinkedsrvlogin 'ORACLEODBC', false, NULL, 'USERNAME', 'Password'
-OR-
Use the ODBC driver for ORACLE that is provided by ORACLE:
EXEC sp_addlinkedserver #server = 'ORACLEODBC', #srvproduct = 'MSDASQL', #provider = 'MSDASQL',
#provstr = 'DRIVER={ORACLE ODBC DRIVER};SERVER=MyOracleServer;UID=USERNAME;PWD=Password;DBQ=ORACLE805;'
go
sp_addlinkedsrvlogin 'ORACLEODBC', false, NULL, 'USERNAME', 'Password'
Hope this helps.

OLE DB provider "Search.CollatorDSO" returns "Command was not prepared"

Has anybody been able to connect to Windows Search Service using the OLE DB Provider for Search in SQL Server? Below you'll find the error message I keep stumbling upon when configuring a Linked Server in Management Studio.
OLE DB provider "Search.CollatorDSO" for linked server "TESTSERVER" returned message "Command was not prepared.".
Msg 7399, Level 16, State 1, Line 2
The OLE DB provider "Search.CollatorDSO" for linked server "TESTSERVER" reported an error. Command was not prepared.
Msg 7350, Level 16, State 2, Line 2
Cannot get the column information from OLE DB provider "Search.CollatorDSO" for linked server "TESTSERVER".
I'm aware more people have been struggling with this problem over the last few years, but I haven't found a solution so far.
For reasons known only to Microsoft*, the Windows Search catalog is not accessible to SQL Server as an OLE DB datasource. The only feasible workaround for this issue is to create a CLR function and use it as a wrapper for querying the search catalog. A ready-to-run example can be found at http://www.nesterovsky-bros.com/weblog/2011/03/04/callingwindowssearchfromsqlserver2008.aspx.
*My best guess is that the search service is only partially SQL-compliant, in that it extends SQL-92 and SQL-99, but does not return the metadata or contain much of the functionality expected of a data source by SQL Server.

Using linked server returns error - "Cannot obtain the schema rowset for OLE DB provider"

I tried to move data aka ETL from one sql server to another as mentioned in a previous question - Copy data from one column into another column. Now, I get an error when I try to execute a query.
Query -
INSERT INTO [Target_server].[Target_DB1].[dbo].[Target_Table1](Target_Column1)
SELECT Source_Column222
FROM [Source_server].[Source_DB1].[dbo].[Source_Table1]
WHERE Source_Column1 = 'ID7162'
Error -
OLE DB provider "SQLNCLI" for linked server "MYLINKEDSERVER" returned message "Unspecified error".
OLE DB provider "SQLNCLI" for linked server "MYLINKEDSERVER" returned message "The stored procedure required to complete this operation could not be found on the server. Please contact your system administrator.".
Msg 7311, Level 16, State 2, Line 1
Cannot obtain the schema rowset "DBSCHEMA_TABLES_INFO" for OLE DB provider "SQLNCLI" for linked server "MYLINKEDSERVER". The provider supports the interface, but returns a failure code when it is used.
If your wrote that simple select is not working, the issue is in security configuration of the linked server and permissions which your user receive there.
Among this, when you execution your query, you don't need to specify the server name and DB name for both parts - source and target. You simply need to execute the query on target server and target database. In this case your query instead of
INSERT INTO [Target_server].[Target_DB1].[dbo].[Target_Table1](Target_Column1)
SELECT Source_Column222
FROM [Source_server].[Source_DB1].[dbo].[Source_Table1]
WHERE Source_Column1 = 'ID7162'
will looks like the following:
INSERT INTO [dbo].[Target_Table1](Target_Column1)
SELECT Source_Column222
FROM [Source_server].[Source_DB1].[dbo].[Source_Table1]
WHERE Source_Column1 = 'ID7162'
and you need your connection to be opened on server [Target_server] and database [Target_DB1]. Also the linked server security properties need to be checked on [Target_server] against the [Source_server].
If you are using loop back linked server (linked server refering to the same database in the same server) then refer the below mentioned link:
Transaction with loopback linked server - locking issues
If that is not the case, this is the solution provided by Microsoft.

able to connect to linked server but i cannot select from any table

I have a linked server to a pervasive sql 11 database from my sql server 2012 64bit using ODBC
I am able to see the databases on this server, but when I select * from any table I am getting this error:
OLE DB provider "MSDASQL" for linked server "kslap208" returned message "[Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC Engine Interface][Data Record Manager]The MicroKernel cannot find the specified file(Btrieve Error 12)".
OLE DB provider "MSDASQL" for linked server "kslap208" returned message "[Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC Engine Interface]Unable to open table: aactual.".
Msg 7306, Level 16, State 2, Line 1
Cannot open the table ""sbxc003"."aactual"" from OLE DB provider "MSDASQL" for linked server "kslap208".
How is it possible that I am able to test the connection succesfully and see all the databases; however, I cannot select?