Groups > Databases > Access Databases and AccessDataSource Control > Re: (OPENROWSET) Error 7399: OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an error.Authentication failed.




(OPENROWSET) Error 7399: OLE DB provider
'Microsoft.Jet.OLEDB.4.0' reported an error.Authentication
failed.

(OPENROWSET) Error 7399: OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an error.Authentication failed.
Tue, 18 Mar 2008 22:31:32 +000
I am trying to create an excel file using openrowset in ms sql 2000.

but i get the following error when I try to create the file...My stored
procedure code is below as well...

Error 7399: OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an 
error.Authentication failed.

What can I do?
-- here is my code

Create PROCEDURE MCA_SP_CREATE_EXCEL @File_Name as varchar(50) = ''
AS
BEGIN
SET NOCOUNT ON
declare @File_Name as varchar(50)
DECLARE @Cmd varchar(1000)
DECLARE @fn varchar(500)
DECLARE @provider varchar(100)
DECLARE @ExcelString varchar(100)

-- New File Name to be created
IF @File_Name = ''
Select @fn = 'C:\Test.xls'
ELSE
Select @fn = 'C:\' + @File_Name + '.xls'

-- FileCopy command string formation
SELECT @Cmd = 'Copy C:\Template.xls ' + @fn

-- FielCopy command execution through Shell Command
EXEC MASTER..XP_CMDSHELL @cmd, NO_OUTPUT

-- Mentioning the OLEDB Rpovider and excel destination filename
set @provider = 'Microsoft.Jet.OLEDB.4.0'
set @ExcelString = 'Excel 8.0;Database=' + @fn

-- Executing the OPENROWSET Command for copying the select contents to Excel
sheet.
exec('insert into OPENrowset(''' + @provider + ''',''' + @ExcelString +
''',''SELECT FirstName,LastName,Phone,Address,City,State,Zip FROM [Sheet1$]'') 
select au_fname as FirstName,au_lname as LastName,phone,address,city,State,Zip
from authors')

exec('insert into OPENrowset(''' + @provider + ''',''' + @ExcelString +
''',''SELECT StoreId, OrderNo, OrderDate, Quantity FROM [Sheet2$]'') 
select stor_id as StoreId,Ord_Num as OrderNo,Ord_Date as OrderDate,qty as
Quantity from sales')

SET NOCOUNT OFF
END
Post Reply
Re: (OPENROWSET) Error 7399: OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an error.Authentication failed.
Thu, 20 Mar 2008 04:06:40 +000
Hi,

Based on my understanding, this issue can occur because the login used to
connect to the SQL Server does not have enough permission. Please add the
following statement to your SP defination (below EXEC sp_addlinkedserver):

EXEC sp_addlinkedsrvlogin 'ExcelSource', 'false',NULL,'ADMIN',NULL

Then drop the existing SP and create a new SP to test the problem. 

Thanks.
Post Reply
Re: (OPENROWSET) Error 7399: OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an error.Authentication failed.
Fri, 21 Mar 2008 00:30:20 +000
Thanks, but in the "excel source", what should i type in ???  
'Microsoft.Jet.OLEDB.4.0'  

or 'Excel 8.0'
Post Reply
Re: (OPENROWSET) Error 7399: OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an error.Authentication failed.
Fri, 21 Mar 2008 09:26:39 +000
Hi, 

Here "ExcelSource" means the database name you want to add permissions
to.

i.e:   

EXEC sp_addlinkedsrvlogin 'Northwind', 'false',NULL,'ADMIN',NULL

Thanks.
Post Reply
about | contact