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
The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.


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

Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

Question has a verified solution.

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

Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to count occurrences of each item in an array.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

705 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