Error querying "Microsoft.ACE.OLEDB.12.0" provider from SQL Server - sql-server

This is not a question, but this post may be useful for community because I could not find the answer on the Internet.
Tested on
Windows 2008 R2 x64 and Windows 2003 x64
SQL Server 2008 SP3 x64
Provider Microsoft.ACE.OLEDB.12.0 x64
SQL Server is running under domain account that is not admin of local machine.
SQL Server connection authentication is Windows.
The issue is:
when creating and using a linked server or adhoc querying using this provider, you may receive errors like these:
OLE DB provider "MSDASQL" for linked server "xxx" returned message "[Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed"
OLE DB provider "MSDASQL" for linked server "xxx" returned message "[Microsoft][ODBC dBASE Driver] Your network access was interrupted. To continue, close the database, and then open it again.
Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server "xxx"
Could not find installable ISAM
OLE DB provider "MSDASQL" for linked server "xxx" returned message "[Microsoft][ODBC dBASE Driver]General error Unable to open registry key Temporary (volatile) Ace DSN for process 0x16f4 Thread 0x2728 DBC 0x1ce64ae8 Xbase'
The reason is that the provider creates a temporary file in SQL Server's domain account's temporary folder, using user connect's credentials. Ordinary users does not have such permissions.

The solution is
grant "Modify" permission to sql server users on Sql Server's domain account's temporary folder.
This folder ordinarily is
Windows 2003: "c:\Documents and
Settings\sql_server_account_name\Local Settings\Temp\"
Windows 2008: "C:\Users\sql_server_account_name\AppData\Local\Temp\"

Related

Can't connect to Azure SQL Server from 1/3 of our servers

I was trying to create a linked server from an on-premises SQL Server (BadMachine1), to an Azure SQL Server.
Code for creating the linked server
EXEC sp_addlinkedserver D365BI_Testing, '', 'SQLNCLI11', #datasrc='blabla.database.windows.net', #catalog = 'DbName'
EXEC sp_addlinkedsrvlogin D365BI_Testing, 'false', null, 'blabla_Admin', 'thepassword'
Created fine, but when testing connection on BadMachine1, this error message:
TITLE: Microsoft SQL Server Management Studio
------------------------------
The test connection to the linked server failed.
------------------------------
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
TCP Provider: The specified network name is no longer available.
Client unable to establish connection because an error was encountered during handshakes before login. Common causes include client attempting to connect to an unsupported version of SQL Server, server too busy to accept new connections or a resource limitation (memory or maximum allowed connections) on the server.
OLE DB provider "SQLNCLI11" for linked server "D365BI_Test2" returned message "Client unable to establish connection due to prelogin failure".
OLE DB provider "SQLNCLI11" for linked server "D365BI_Test2" returned message "Client unable to establish connection". (Microsoft SQL Server, Error: 64)
For help, click: https://learn.microsoft.com/sql/relational-databases/errors-events/mssqlserver-64-database-engine-error
------------------------------
BUTTONS:
OK
------------------------------
OK, tested on two other machines we have (GoodMachine1, GoodMachine2) - all of these are in the same data center. The test connection succeeded on both GoodMachine1 and GoodMachine2, and I could successfully write a query from Goodmachine1 and GoodMachine2's SQL Server, to the Azure SQL Server.
Next test:
Tried logging into each of the 3 machines, and opening up SSMS to try to connect to the Azure SQL Db. Connection worked on GoodMachine1 & GoodMachine2. Failed on BadMachine1, with the following error message.
TITLE: Connect to Server
Cannot connect to blabla.database.windows.net.
------------------------------
ADDITIONAL INFORMATION:
A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 0 - The specified network name is no longer available.) (Microsoft SQL Server, Error: 64)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=64&LinkId=20476
------------------------------
The specified network name is no longer available
------------------------------
BUTTONS:
OK
------------------------------
I don't have access to check, but I'm told the firewall rules are OK on the Azure side.
There are some characteristics that differ among the 3 machines:
BadMachine1: ODBC Driver 11, old "Microsoft AS OLE DB Provider for SQL Server 2014". SQL Server 2014
GoodMachine1: ODBC Drivers 11, 13, 17, no OLE driver. SQL Server 2016
GoodMachine2: ODBC Driver 13, recent install of OLE driver. SQL Server 2016
Could the old ODBC driver on BadMachine1 be it? Other ideas? Apologies in advance, I've never tired to setup a linked server before, and don't really know what I'm doing very well.
Turns out our IT was blocking those outbound connections from BadMachine1. Now that they're unblocked, the linked server works fine.

Can't create linked server from microsoft SQL to Snowflake

Created DNS and installed ODBC Drivers followed same steps from below URL
https://snowflakecommunity.force.com/s/article/how-to-set-up-a-linked-server-from-sql-server-to-snowflake
Once creating testing connection at last step it shows error like
OLE DB provider "MSDASQL" for linked server "SNOWFLAKEDATA" returned message "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified". (Microsoft SQL Server, Error: 7303)
But DNS created and used followed same way in URL. Can i know where I made mistake?
Please ensure to create the linked server to Snowflake with the following information:
Provider: This should be "Microsoft OLE DB Provider for ODBC Drivers."
Data Source: This should match the ODBC system/user DSN name that was previously configured
Under the Security Tab on left panel, make sure to add a local login (your local machine's login including your host name) associated to a remote user (snowflake username) and its matching password.

Cannot generate SSPI context when creating External Data Source in SQL 2019

I'm trying to create an External Data Source for PolyBase via ODBC connectors in SQL Server 2019, but I'm getting the error:
OLE DB provider "MSOLEDBSQL" for linked server "(null)" returned message "Cannot generate SSPI context".
Msg -2146893042, Level 16, State 1, Line 11
SQL Server Network Interfaces: No credentials are available in the security package
I am using SSMS 18.4 and I'm running the following command:
CREATE EXTERNAL DATA SOURCE TEST
WITH (
LOCATION = 'odbc://sap.company.com',
CONNECTION_OPTIONS = 'DSN=SAP',
CREDENTIAL = my_creds
);
I did a fair amount of reading and it seems like the error can be 1 of many things. But I can't really find anything where it relates to External Data Sources.
Any advice or guesses will be appreciated.
I'm running SQL 2019 Developer (RTM) 64 bit on Windows 10
I have an ODBC entry called SAP that connects succesfully
my_creds has been created in SQL with SAP user name and password.
My SQL 2019 PolyBase Engine service is running under Network Service (same with the PolyBase Data Movement service).
TCP/IP has been enabled on the PolyBase service.

TSQL Having trouble adding a linked SQL Server 2008 R2 to SQL Server 2000

I'm having trouble trying to create a Linked Server to connect from a SQL Server 2008 R2 instance to a SQL Server 2000 instance using Windows Auth.
I can connect to SQL Server 2000 with SSMS with Windows Auth so network and user permissions should be OK.
Here's what I'm using so far
EXEC master.dbo.sp_addlinkedserver
#server = N'SalesLogix_db'
,#srvproduct=N'SalesLogix_db'
,#provider=N'SQLNCLI'
,#datasrc=N'xxx.xxx.xxx.xxx'
GO
--Windows Authentication
EXEC master.dbo.sp_addlinkedsrvlogin
#rmtsrvname=N'SalesLogix_db'
,#useself=N'True'
,#locallogin=NULL
,#rmtuser=NULL
,#rmtpassword=NULL
GO
EXEC master.dbo.sp_testlinkedserver SalesLogix_db;
And this is the error.
OLE DB provider "SQLNCLI10" for linked server "SalesLogix_db" returned message "Login timeout expired".
OLE DB provider "SQLNCLI10" for linked server "SalesLogix_db" returned message "A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.".
Msg 53, Level 16, State 1, Line 24
Named Pipes Provider: Could not open a connection to SQL Server [53].
Where am I going wrong?
Thanks in advance
+1, I got the exact same error message today in a similar setup (sql 2008 R2 server linking to a sql 2008 server). I had existing linked servers which worked fine, but all of a sudden stopped working (exact same error message as you).
I narrowed it down to a batch of recent Windows Security Updates (~14 of them) on the linked server (running windows 2008 R2). I ended up rolling back those updates which resolved the issue temporarily.
At this point, I'm trying to figure out which one of these updates (KBxxxx) is the exact culprit.
After much toing and froing I finally found the answer.
I was failing with double-hop authentication failure.
When I created the Linked Server using SSMS on the db server itself it worked.

How to create linked server from SQL Server 2014 to SQL Server 2012

I have two machines one is running SQL Server 2014 (Machine A) and the other one SQL Server 2012 (Machine B). Machine A has storage limitation and hence I decided to leave all databases on the Machine B so I can connect and use data from Machine A.
I set Machine B so I can connect it remotely. Now, I am able to connect from Machine A to Machine B. My problem is that, I am unable to push my data from Machine A to B. I guess I need Linked-Server. I tried to build Linked server but when I make linked server, it gives me below error:
Named Pipes Provider: Could not open a connection to SQL Server [5].
OLE DB provider "SQLNCLI11" for linked server "192.168.0.18/SQLEXPRESS" returned message "Login timeout expired".
OLE DB provider "SQLNCLI11" for linked server "192.168.0.18/SQLEXPRESS" returned message "A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.". (Microsoft SQL Server, Error: 5)
Linked server name is : 192.168.0.18/sqlexpress and I set to use my user name and password.
Machine A: Mac running Microsoft Windows on Parallel (I connect using Win 8.1 that runs over Mac Yosemite).
Machine B: Windows 8.1 on physical server (no VM).
I have enabled Named Pipe from network configuration of my Machine B SQL server. However, I think I need to do some modification on port number with my Firewall.
UPDATE: I disabled Firewall on Machine B, but no clue yet.
Please advise.
Thanks
It gave the same error to me
Msg 15015, Level 16, State 1, Procedure sp_addlinkedsrvlogin, Line 49
The server '.\SQLEXPRESS' does not exist. Use sp_helpserver to show available servers.
but still created the server ,so try .\SQLEXPRESS and see..!!
Also, if this doesn't work try
EXEC sp_helpserver
and see the full name of the server and then see if your linked server comes there..!!

Resources