4

I have tried to make use of linked servers in SQL Server 2008 by doing the following to access a Microsoft Access 2003 Table.

EXEC sp_addlinkedserver access1t, 'OLE DB Provider for Jet', 'Microsoft.Jet.OLEDB.4.0', 'C:\tester.mdb'
EXEC sp_addlinkedsrvlogin access1t, FALSE, Null, Admin, Null
GO
CREATE VIEW TI001APCE1265 AS SELECT * FROM access1t...Table1

However, I get the error:

OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "access1t" returned message "Unspecified error".
Msg 7303, Level 16, State 1, Procedure TI001APCE1265, Line 1
Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "access1t".

There is no password/username on my access database but looking at the documents I understood I had to use the sp_addlinkedsrvlogin like the above. I have tried it without a login either.

Bit I still get the same error - what is going?!

Thanks all

Debug Output

Array ( [0] => Array ( [0] => 42000 [SQLSTATE] => 42000 [1] => 7303 [code] => 7303 [2] => [Microsoft][SQL Server Native Client 10.0][SQL Server]Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "access1265293168". [message] => [Microsoft][SQL Server Native Client 10.0][SQL Server]Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "access1265293168". ) [1] => Array ( [0] => 01000 [SQLSTATE] => 01000 [1] => 7412 [code] => 7412 [2] => [Microsoft][SQL Server Native Client 10.0][SQL Server]OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "access1265293168" returned message "Unspecified error". [message] => [Microsoft][SQL Server Native Client 10.0][SQL Server]OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "access1265293168" returned message "Unspecified error". ) )

3
  • I was having a look at this question: stackoverflow.com/questions/2065083/… - how would I pass in the NT login?? Commented Feb 4, 2010 at 15:01
  • NT AUTHORITY\SYSTEM doesn't work either, if it is that. Commented Feb 4, 2010 at 15:04
  • Have you tried providing the Jet default username, "admin"? I don't know if it's required or not, but there is no such thing as opening a Jet data store without having a user involved. Commented Jan 15, 2011 at 1:03

1 Answer 1

4

Have you tried with named parameters?:

EXEC sp_addlinkedserver 
   @server = 'access1t', 
   @provider = 'Microsoft.Jet.OLEDB.4.0', 
   @srvproduct = 'OLE DB Provider for Jet',
   @datasrc =  'C:\tester.mdb'
GO

It may be you just need your server name in single quotes 'access1t'.

[ Does your logged in user have permission to access the root of C: drive? ]

Sign up to request clarification or add additional context in comments.

4 Comments

I am logged in as Admin. I thought because I passed in false for @useself attribute of sp_addlinkedsrvlogin - it would only use the username and password I have supplied to access the Microsoft access database. I have also just tried your code and removed my first line and I still get the same error. I have added some debug output with sql server error codes, but I have no idea what they mean!
I played around with this a bit, and for me the error seems to have been due to permissions. When I logged in to SQL Server as the Admin user for this PC, I could connect to c:\docs\test.mdb as illustrated above, with other messing about, I could not.
@Remou I think its a permissions/credentials problem. I am using this EXEC sp_addlinkedsrvlogin acc465tghv, TRUE and this seems to be working. I am just testing and playing around with now.
A Jet/ACE data store has to be writable to be used, so you need to store it in a location that is read/write for the Windows logon you're running with. By default, the root of C: is read-only for non-admin users (starting with Win2000, as a matter of fact), so it's very likely that the problem is NTFS permissions on the root of C: preventing the write access that is needed here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.