Issues connecting from SQL Server to MS Access database - sql-server

Environment: Windows Server 2016, SQL Server 2016; MS Access .accdb files (various versions)
Attempting to establish a linked server via oledb to an .accdb file content like this:
EXEC master.dbo.sp_addlinkedserver
#server = N'redacted',
#srvproduct = N'',
#provider = N'Microsoft.ACE.OLEDB.16.0',
#datasrc = N'D:\AccessTest\redacted.accdb',
#provstr = N'Jet OLEDB:Database Password=redacted;'
This causes an error:
The OLE DB provider "Microsoft.ACE.OLEDB.16.0" for linked server "redacted" reported an error. The provider reported an unexpected catastrophic failure. (Microsoft SQL Server, Error: 7399)
Attempted fixes:
Varying provider strings, like 'Uid=;Pwd='
Check AccessDB engine is installed (64bit)
Moved db to local drive (from network)
OLE provider set 'Allow Inprocess' to true
The database appears to be accessible through MS Access front end. No signs of corruption.
Any ideas?

Related

Data Encryption with Linked Servers In SQL Servers

We have MS Access Databases and they are linked to SQL servers via linked servers.
We would like to enable the data encryption when data transit between SQL server and linked servers.
In this process, We added Encrypt=Yes option in linked server definition while creating.
```
EXEC master.dbo.sp_addlinkedserver
#server = N'REGISTRATION_NAME',
#srvproduct=N'',
#provider=N'SQLNCLI',
#datasrc=N'SERVER\INSTANCE',
#provstr=N'Encrypt=yes;',
#catalog = 'DATABASE_NAME'
```
After this, We get different errors when I try to query from linked servers.
Here are the some of the errors.
SSMS throws error
"Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server"
If the security option is "Not be made" then below error is throwing.
"Access to the remote server is denied because no login-mapping exists. (.Net SqlClient Data Provider) *
Please help me to understand and resolve these errors.

SQL Server 2019 Polybase error - cant create External Data Source to SQL Server 2019

I am trying to setup an external data source in SQL Server 2019 to another database on the same server.
I am doing this to replicate the SQL Azure setup currently running in production.
I tried the following to set it up
I installed SQL Server 2019 Express
I installed Polybase
I enabled TCP/IP and made sure services were running
I then ran
USE master
CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'xxxxxxxxxxxxxxxxxxx'
EXEC sp_configure #configname = 'polybase enabled', #configvalue = 1;
RECONFIGURE;
USE mydb
CREATE DATABASE SCOPED CREDENTIAL SqlServerCredentials
WITH IDENTITY = 'sa', SECRET = 'xxxxxxxx';
CREATE EXTERNAL DATA SOURCE SQLServerInstance
WITH ( LOCATION = 'sqlserver://.\sqlexpress',
PUSHDOWN = ON,
CREDENTIAL = SQLServerCredentials);
On the final CREATE EXTERNAL DATA SOURCE statement I get this error
OLE DB provider "MSOLEDBSQL" for linked server "(null)" returned message "Cannot generate SSPI context".
Msg -2146893042, Level 16, State 1, Line 0
SQL Server Network Interfaces: No credentials are available in the security package
I can't seem to figure out why I get this error

Restore big database from SQL server 2014 into SQL Server 2008

I just bought a new 2008 SQL server license and am now trying to move my 10gb database from 2014 express(12.0.5203) to 2008 (10.0.1600.22)
I have tried the "export DB to script" way, but the file is very big(20GB) and a lot of data is not getting imported because of several datatype convertion errors.
Currently I am trying to copy the data by scripts like
SELECT *
INTO database.dbo.table
FROM OPENQUERY([localhost\WAWI], ' SELECT *
FROM [localhost\WAWI].database.dbo.[table]')
While having created a connection in sys.servers
EXEC sp_addlinkedserver #server='WAWI'
EXEC sp_addlinkedsrvlogin 'localhost\WAWI', 'false', NULL, 'sa', 'password'
But while executing the import script I am not able to connect to the local 2014 server even so I have opened it in the object explorer in a query window opened by the remote 2008 server
I get the following error message
The OLE DB provider 'SQLNCLI10' for linked server 'WAWI' has the message 'Login timeout expired' return.
The OLE DB provider 'SQLNCLI10' for linked server 'WAWI' has the message ' network-related or instance-specific error when establishing a connection to SQL Server. The server could not be found, or it can not be accessed. Verify that the instance name is correct and that allows SQL Server remote connections. For more information in SQL Server Books Online.' return.
Message 53, level 16, State 1, line 20
Named pipes provider: it could be made cannot connect to SQL Server [53].

How can I connect to a local ODBC datasource

I created an ODBC database on my local machine with driver SQL server Native client 10.0, which connects to a remote server, see
.
I am working on a project about customized ODBC to an inhouse database and want to Test how I can connect to a data source using ODBC.
The question is how can I connect to the local ODBC using sql server studio manager? I tried
but it returns an error:
A network-related or instance-specific error occurred while
establishing a connection to SQL Server. The server was not found or
was not accessible. Verify that the instance name is correct and that
SQL Server is configured to allow remote connections. (provider: Named
Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Any idea?
Connect to your local server through SSMS then create a linked server to the ODBC connection.
Echoing #Brian Boyd...
It is possible to create an ODBC connection to a SQL server running locally.
If you start SSMS and point it to a local database engine the Server Name should be Computer_Name\SQLEXPRESS with Authentication set to Windows Auth (ie the logged-in user: you). Computer_Name is found in the System window (Windows Key + Break) and is not localhost, 127.0.0.1, etc.
So, to set up an ODBC connection by running %windir%\syswow64\odbcad32.exe
In the System DSN tab, click [Add...]
Select SQL Server in the drivers list, click [Finish]
Now add a Name and Description but most importantly set the Server to be Computer_Name\SQLEXPRESS (whatever was shown in SSMS)
Click [Next] and leave the authentication set to Windows NT
Click [Next] and tick the default database tickbox to reveal a list of databases locally (if yours is listed here the ODBC settings have already worked)
Click [Next], [Finish] then [Test Data Source...] then all should be well
To connect to a remote server you don't need a DSN. You can enter the server name in the Server name field of SQL Server Management Studio and select Windows authentication or Database authentication.
It is not possible to connect SSMS to an ODBC data source. The only way is to create a linked server in your local SQL server as #Brian Boyd described.
Instructions are:
https://community.sagecrm.com/partner_community/b/hints_tips_and_tricks/archive/2010/05/10/connecting-to-a-sage-mas-erp-90-database-as-a-linked-server-within-ms-sql-server-2008.aspx
... and sp_AddLinkedServer documentation from MS HERE
… and with search = “sp_addlinkedserver for SOTAMAS90“, even an example from 2005
https://blog.coryfoy.com/2005/06/lets-go-crazy-accessing-timberline-pervasive-data-from-a-sql-linked-server/
Let’s see what turn says …. And think I will / would get the same error adding a linked server through UI that I get TSQL
Based on above, I tried …
EXEC sp_addlinkedserver
#server = 'TimberlineTest',
#provider = 'SOTAMAS90', -- Original command #provider = MSDASQL',
#srvproduct = '', --- MAS 90 4.0 ODBC Driver Original is #srvproduct='Timberline Data',
#datasrc = 'DataTest'

SQL Server linked server not working in ASP Classic

I've created a linked server to an Excel spreedsheet. It's ok and working in SQL Server I can query excel file in query analyzer.
But when I'm trying to access this link server in my asp page:
Set pishbini = Server.CreateObject("ADODB.Recordset")
pishbini.ActiveConnection = MM_semmet_STRING
pishbini.Source = "SELECT * FROM OPENQUERY(SemnanmetWeekly, 'SELECT * FROM [DayPish$]')"
pishbini.CursorType = 0
pishbini.CursorLocation = 2
pishbini.LockType = 1
pishbini.Open()
SemnanmetWeekly is the name of linked server in SQL Server I'm getting this error in my asp page:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]OLE DB provider
"Microsoft.Jet.OLEDB.4.0" for linked server "SemnanmetWeekly" returned
message "Cannot start your application. The workgroup information file
is missing or opened exclusively by another user.".
/Daypish.asp, line 15
IUSR (IIS user) has full access to excel file, I have played with all the different options in in my Link Server Options like impersonating or accessing excel file with administrator account, but error remained the same!
I prefer to not change the code, since I'm only doing administration stuff on this server. it has been working on an old server but since we moved it to new server it stopped working. anything I'm missing here?
Not related to permissions. I think you logged in to Sql Server with Windows Authentication, everything is okay, you're the boss. But, if the connection in ASP is SQL authenticated, you get this error. So, you should add a linked server login with a query similar to following.
Exec master..sp_addlinkedsrvlogin
#rmtsrvname = N'SemnanmetWeekly',
#useself = N'False',
#locallogin = N'sa', /* replace your own - same as sql server authenticated account */
#rmtuser = NULL,
#rmtpassword = NULL
Then you can connect to SemnanmetWeekly in your ASP application.

Resources