Your specified path is wrong.
It should be as following example for an Excel sheet:
select * from OPENROWSET(
'Microsoft.ACE.OLEDB.12.0','Excel 8.0;Database=D:\Band.Xlsx',
'SELECT * FROM [SheetName$]');
Question
I am trying to connect to an Access 2000 database from SQL Server Management Studio. My current query is:
sp_configure 'show advanced options', 1;
RECONFIGURE;
GO
sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;
GO
Select FName
From
OpenRowSet('Microsoft.ACE.OLEDB.12.0',
'\\bespin\Files\GDrive\CPros\Databases\Client.mdb';
'admin';'',
Residents)
Originally, I was attempting to use Microsoft.Jet.OLEDB.4.0 as the provider. Since both servers are actually running on 64-bit operating systems, I had to switch to Microsoft.ACE.OLEDB.12.0.
Running this query returns the following error:
OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" returned message "The Microsoft Access database engine cannot open or write to the file '\\bespin\Files\GDrive\CPros\Databases\Client.mdb'. It is already opened exclusively by another user, or you need permission to view and write its data.".
Msg 7303, Level 16, State 1, Line 2
Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)".
I have checked, nobody else has the database open. If I try and change the username and password to something with administrative access to the database, it returns the following error instead:
OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" returned message "Not a valid account name or password.".
Msg 7399, Level 16, State 1, Line 2
The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" reported an error. Authentication failed.
Msg 7303, Level 16, State 1, Line 2
Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)".
Ultimately, what I need to happen is to be able to run a series of INSERT/UPDATE statements to keep the database current until we replace it further on in our conversion process. What do I need to change in order to get these queries to run successfully?
Solution 2
Your specified path is wrong.
It should be as following example for an Excel sheet:
select * from OPENROWSET(
'Microsoft.ACE.OLEDB.12.0','Excel 8.0;Database=D:\Band.Xlsx',
'SELECT * FROM [SheetName$]');
OTHER TIPS
Try this, please take note of the user Admin, it is case sensitive
Select FName
From
OpenRowSet('Microsoft.ACE.OLEDB.12.0',
'\\bespin\Files\GDrive\CPros\Databases\Client.mdb';
'Admin';'',
Residents)