473,804 Members | 3,138 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Ad hoc access to OLE DB provider 'Microsoft.Jet. OLEDB.4.0' has been denied

37 New Member
Trying to open a SQL Server query but am getting this message:

Ad hoc access to OLE DB provider 'Microsoft.Jet. OLEDB.4.0' has been denied. You must access this provider through a linked server.

Heres the script:

Expand|Select|Wrap|Line Numbers
  1. Insert into OpenDataSource( 
  2.     'Microsoft.Jet.OLEDB.4.0',
  3.       'Data Source="H:\Imran\Capacity Planning 0708\UHL Spells Apr 05 to Sept 07 TEST.xls";
  4.     Extended properties=Excel 5.0')...[PivotSh$]
  5. (Provider_Code, Commissioner_Code, LSS_Flag, Financial_Year, Financial_Month, Qtr,
  6.     Description_Contract, Activity_Type_Grouped, Sum_of_Spells)
  7.  
  8. Select    Provider_Code, Commissioner_Code, LSS_Flag, Financial_Year, Financial_Month,
  9.     Case    When Financial_Month between '1' and '3' Then 'Qtr 1'
  10.         When Financial_Month between '4' and '6' Then 'Qtr 2'
  11.         When Financial_Month between '7' and '9' Then 'Qtr 3'
  12.         When Financial_Month between '10' and '12' Then 'Qtr 4' Else '' End as Qtr,
  13.     Description_Contract,
  14.     Case    When Activity_Type in ('Emergency','Non-elective') Then 'Non-Elective'
  15.         Else Activity_Type End as Activity_Type_Grouped,
  16.     SUM(Total_Spells) as Sum_of_Spells
  17.  
  18. From    [Busobjects].Capacity_Planning.dbo.tbl_BaseLine_UHL_Spells_Trend_0708 a
  19.  
  20. Inner     Join OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
  21.               'Data Source="H:\Imran\Capacity Planning 0708\UHL Spells Apr 05 to Sept 07 TEST.xls";
  22.             Extended properties=Excel 5.0')...[SPECIALTY TREND by Month$] as PR
  23.      On PR.P1 = Commissioner_Code 
  24.     AND PR.P2 = LSS_Flag
  25.     AND PR.P3 = Description_Contract
  26.     AND PR.P4 = (Case When Activity_Type in ('Emergency','Non-elective') Then 'Non-Elective'
  27.     Else Activity_Type END)
  28.  
  29.  
  30. Left    Outer Join [Busobjects].Capacity_Planning.dbo.tbl_Refs_Specialty_UHL b
  31.     on a.Specialty_Code = b.Code
  32.  
  33. Left    Outer Join [Busobjects].Capacity_Planning.dbo.tbl_Refs_IP_SpecServ_0708 c
  34.     on a.Specialised_Services_Code = c.SpecServ
  35.  
  36. Left    Outer Join [Busobjects].Capacity_Planning.dbo.tbl_Refs_IP_HRG_Tariff_0708 d
  37.     on a.HRG_Code = d.HRGCode
  38.  
  39. Group    by Provider_Code, Commissioner_Code, LSS_Flag, Financial_Year, Financial_Month,
  40.     Case    When Financial_Month between '1' and '3' Then 'Qtr 1'
  41.         When Financial_Month between '4' and '6' Then 'Qtr 2'
  42.         When Financial_Month between '7' and '9' Then 'Qtr 3'
  43.         When Financial_Month between '10' and '12' Then 'Qtr 4' Else '' End,
  44.     /*Specialty_Code,*/ Description_Contract, --Activity_Type,
  45.     Case    When Activity_Type in ('Emergency','Non-elective') Then 'Non-Elective'
  46.         Else Activity_Type End--, HRG_Code + ': '+ d.HRGDesc,
  47.     --Specialised_Services_Code + ': '+c.Description
Nov 21 '07 #1
2 17363
deepuv04
227 Recognized Expert New Member
Try the following query to read the data from excel sheet

Expand|Select|Wrap|Line Numbers
  1.     sp_configure 'show advanced options', 1
  2.     RECONFIGURE
  3.     GO
  4.     sp_configure 'Ad Hoc Distributed Queries', 1
  5.     RECONFIGURE
  6.     GO
  7.  
  8. SELECT * 
  9. FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
  10.                 'Excel 8.0;Database=C:\Documents and Settings\Administrator\Desktop\rolemenu.xls',
  11.                 'SELECT * FROM [Sheet1$] where MenuItemId is not null')
make sure your excelsheet is on server...

for more information visit the following link

** Edit **
Removed link to competing forum site. Please check out our FAQ.
Nov 22 '07 #2
Santhanams
1 New Member
If i run the OpenRowSet Query under sysadmin role it is working perfectly. But if the same query running under public role, then it is not working. It is giving following message like "Ad hoc access to OLE DB provider 'Microsoft.Jet. OLEDB.4.0' has been denied". I am trying to use least privilage account for my application. Do we need sysadmin role to run OpenRowSet query? Kindly help me out to resolve the Issue. Thanks in advance
Sep 2 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

11
3770
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows 2003 Server or ADO or ODBC issue, I am posting this on all of the three newsgroups. That's the setup: Windows 2003 Server with IIS and ASP.NET actiavted Access 2002 mdb file (and yes, proper rights are set on TMP paths and path,
1
11728
by: Mahesh Hardikar | last post by:
Hi , I have been trying to connect to access database from SQL Server 7.0. This machine is having 7.0 as a default instance and 2000 as a named instance. Also the machine doesn't have access installed and Microsoft.Jet.4.0 is of version SP8 for Windows 2000 The access database is password protected. I have tried all, OPENROWSET, OPENDATASOURCE, linked server, and ODBC.
0
8306
by: Jim Andersen | last post by:
Hope this helps someone. SQL server 2000. I imported some text into a table. "insert into tbltst (field1, field2) SELECT field1, field2 FROM OpenDataSource('Microsoft.Jet.OLEDB.4.0','Data Source=c:\temp;Extended properties=Text')...tstfile#txt" It worked great. As long as I was logged in as user sa. When I finished testing, I began to receive the error:
2
7849
by: Randy | last post by:
I am trying to relink some Oracle tables in an Access database via VB.NET and ADOX. I receive the following error when executing the cat.ActiveConnection link "Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. Here is my code Dim cat As ADOX.Catalog = New ADOX.Catalo Dim tbl As ADOX.Tabl Dim OracleConn As String = "Provider=MSDAORA.1;Data Source=xzy;User ID=xyz;Password=xyz
6
2020
by: Ben | last post by:
I am trying to migrate my vb6.0 over to vb.net. Here is the error that that I am stuck with: Public myDB As DAO.Database ..... path = System.IO.Path.GetFullPath("..") myDB = WS.OpenDatabase(path & "\access.MDB", False, True) 'after I've created my workspace where WS is my workspace, I opend it up and vb.net recognized it. DeckUsers = dbCycDeck.OpenRecordset("USERS")
5
3916
by: somersbar | last post by:
hello all, im trying to connect to a microsoft access database from an ASP.NET web form. i keep getting the following error though: ERROR Could not use '(unknown)'; file already in use. ERROR Driver's SQLSetConnectAttr failed ERROR Could not use '(unknown)'; file already in use.
9
3848
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web site for a small club I belong to and one of the features I would like to include is the ability to allow users to upload image files. unfortunately the servers web root www folder only allows READ and EXECUTE permissions, which makes it...
24
5085
by: dancer | last post by:
Using ASP.net 1.1 and Microsoft Access. I received the following error message. Why? I have closed the Access file. I have another very small access file that opens with no trouble with the same code, except a different name for the file. The Microsoft Jet database engine cannot open the file 'C:\Inetpub\wwwroot\Accident.mdb'. It is already opened exclusively by another user, or you need permission to view its data.
1
2620
by: dellis | last post by:
Problem: My project was initially created without putting passwords in the connection string. When I added the password in the connection string, it disappears when performing a database fill. I have stepped through the code in debug and the connection string is correct up til the Fill command. Once the fill executes, the password disappears from the connection string. This particular Fill is performed to check that the user is valid for this...
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10077
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9152
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7620
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5522
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2991
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.