Permission to access the database file in network driver through Web

Posted on 1998-03-21
Last Modified: 2013-12-25
It is a typical 3-tier enviroment.
There are 3 PCs on the lan  :
PC1. a win95 client having a web browser
PC2. a winnt 4 (pdc server or just server) having IIS 3, *.asp, odbc driver (to read  database file like access , foxpro.. and so on)
PC3. a winnt 4 pdc server storing database file
PC2 has a network driver say F: in which database file
come from PC3
In PC3, i grant all read/write/execute  permission on the database
files to Everyone.   But , there is an error about the permission
problem when i sit at PC1 and read asp page stored in PC2.

Can anyone give me some advice in this problem?
alan pong
below is the asp in PC2
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "access"
Set RS = Conn.Execute("SELECT * FROM `f:\temp\AdvWorks`.Orders")
<% For i = 0 to RS.Fields.Count - 1 %>
      <TD><B><% = RS(i).Name %></B></TD>
<% Next %>
<% Do While Not RS.EOF %>
      <% For i = 0 to RS.Fields.Count - 1 %>
            <TD VALIGN=TOP><% = RS(i) %></TD>
      <% Next %>


Question by:alanpong
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 1858045
If you set your ODBC datasource from PC2 and map it to the one on PC3 then
you do not need to do your querie hardcoding the drive path etc.

You can just do a SQL select as per normal.
You should be able specify which datasource you are querying from.

Author Comment

ID: 1858046
Sorry, there's still error message :
"Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Microsoft Access 97 Driver] The Microsoft Jet database engine cannot open the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view its data.

/test/ado1.asp, line 9 "

 even i 've  tried what you mentioned :
Set RS = Conn.Execute("SELECT * FROM Orders")

Also, i've set f:\ , f:\temp , and f:\temp\*.* can be fully controlled

However, when i copy the mdb file into harddisk of PC2 and set up
the odbc driver in PC2 to point to its local driver, the above does works.
Also, i can read vfp 3.0 dbf which is stored in  
PC2 's harddisk.  However, when i copy the vfp 3.0 dbf to PC3
, i cannot read again through odbc.

I 've check the Server Manager but cannot find any lock on the file.


Expert Comment

ID: 1858047
Sounds like a security Issue to me...
IIS usually tries to log in to the database server using the IUSR_WEBSERVER account. So you could try to re-create Your IUSR_PC2 account on PC3 with the exact same password.
That way, the annonymous account will be authenticated on the web server
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.


Author Comment

ID: 1858048
What is the default password of iusr_xxx which was created
 during the installation of iis?
Is there any side-effect if i change this password?

Expert Comment

ID: 1858049
The default password is a random generated password, so you will have to change it to something else.
There is one little side-effect.
You will have to change the "annonymous logon" password in your IIS as well (under the WWW service properties)
Hope this helps !!

Author Comment

ID: 1858050
Sorry for late response since i 've been frustrated by this problem for a
week.... However, i still cannot fix it. :~<

In order to simplify the problem, I consider ONLY ONE winnt PC
(having iis4 and msado 1.5).  And it map itself a network drive F:
which is actually my harddisk C: driver.

However, there 's still the error when i try to open foxpro dbf  in F
 driver (but it is ok when open c: driver) :

"Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Visual FoxPro Driver]File 'hrpers.dbf' does not exist.

/test/ado1.asp, line 10 "

And there 's still error when i try to open access database in F driver
 (but it is ok when open c: driver) :
"Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Microsoft Access 97 Driver] The Microsoft Jet database engine cannot open the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view its data.

/test/access.asp, line 9 "
Also, I try trace the odbc function call by "odbc trace"
(control panel -> odbc -> tracing ) I got the "return code -1" when
open the database in  F: driver.  Here is an extract from the log file :

inetinfo        b7:115      ENTER SQLExecDirectW
            HSTMT               0x018c9fc8
            WCHAR *             0x00285200 [      26] "SELECT p_empno FROM hrpers"
            SDWORD                    26

inetinfo        b7:115      EXIT  SQLExecDirectW  with return code -1 (SQL_ERROR)
            HSTMT               0x018c9fc8
            WCHAR *             0x00285200 [      26] "SELECT p_empno FROM hrpers"
            SDWORD                    26

            DIAG [S0002] [Microsoft][ODBC Visual FoxPro Driver]File 'hrpers.dbf' does not exist. (173)

            DIAG [S0002] [Microsoft][ODBC Visual FoxPro Driver]File 'hrpers.dbf' does not exist. (173)

But, no such error, when i open the database in C:
Also,it is ok when using vfp command window or  msquery to
 open database through F driver.

Many thanks.


Accepted Solution

hkp earned 250 total points
ID: 1858051
I sounds like a ODBC problem.
I would setup the ODBC driver to refer to the f:\temp\AdvWorks directory

I suggest the following:
1. From the Control Panel, open the ODBC Icon.
2. Select System DSN tab.
3. Push the Add button.
4. Select Microsoft FoxPro driver.
5. Enter a data source name: MyDatabase
6. Select the correct version of FoxPro database
7. Deselect the "Use Current Directory"
8. Push the "Select Directory..." button.
9. Select the F: drive and the directory where the FoxPro database is located.
10. Push OK button in the "ODBC Microsoft FoxPro Setup" window.
11. Push OK button in the "ODBC Database Administrator" window.

Now you have successfully setup the ODBC Database, named "MyDatabase". Then, if you want to use it from ASP.

<% Set Conn =Server.CreateObject("ADODB.Connection")
 Conn.Open "MyDatabase"
 Set RS = Conn.Execute("SELECT * FROM Orders") %>

Then you can substitute it into your ASP code above.


Author Comment

ID: 1858052
GIVE UP! (this question can be closed)
For access, the odbc driver work if i use UNC name.
ConnectStr  = "DBQ=\\server\share\mytable; Driver = {MS Access...
Set Conn = Server.CreateObject("ADODB.Connection")
Set RS = Conn.Open ....

However, VFP odbc 5.x still does not work while reading
from network driver.

Finally,I am going to use remote automation through foxisapi.dll.

HKP, the odbc driver you mentioned is 3.5xxx which can read
foxpro 2.5 , 2.6 and vfp dbf file.  However, it cannot read
vfp 5 dbc file.  Therefore, your driver does not
support relationship ,stored procedure, trigger, default,
 rules and so on, also data integrity is difficult to maintain.



Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question