Click here to Skip to main content
15,912,082 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi guys
i have a table in access and i want to get the data from this table using a query from Sql2005 and i found that i should create a server and i do that but an error come from when i trying to get the data and this is the code
EXEC sp_addlinkedserver
@server = 'AccessDB',
@provider = 'Microsoft.Jet.OLEDB.4.0',
@srvproduct = 'OLE DB Provider for Jet',
@datasrc = 'C:\Path\to\Access\Database.mdb'
GO


...............
<pre lang="sql">
SELECT *
FROM OPENQUERY(AccessDB,'SELECT * FROM DPI Crosses')




the error is

MSIL
OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "AccessDB" returned message "'C:\Path\to\Access\Database.mdb' is not a valid path.  Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.".
Msg 7303, Level 16, State 1, Line 1
Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "AccessDB".
Posted
Updated 9-Feb-11 15:02pm
v3

1 solution

Do you have MS Access installed? Is the path correct?

FROM MSDN HELP: SEE half way down in this page[^]

This example assumes that both Microsoft Access and the sample Northwind database are installed and that the Northwind database resides in C:\Msoffice\Access\Samples.<br />
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900