Link to home
Start Free TrialLog in
Avatar of alanpong
alanpong

asked on

Permission to access the database file in network driver through Web

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?
Thanks.
rgds.
alan pong
alanpong@hkstar.com
--
below is the asp in PC2
<HTML>
<HEAD>
<TITLE>testing</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "access"
Set RS = Conn.Execute("SELECT * FROM `f:\temp\AdvWorks`.Orders")
%>
<P>
<TABLE BORDER=1>
<TR>
<% For i = 0 to RS.Fields.Count - 1 %>
      <TD><B><% = RS(i).Name %></B></TD>
<% Next %>
</TR>
<% Do While Not RS.EOF %>
      <TR>
      <% For i = 0 to RS.Fields.Count - 1 %>
            <TD VALIGN=TOP><% = RS(i) %></TD>
      <% Next %>
      </TR>
      <%
      RS.MoveNext
Loop
RS.Close
Conn.Close
%>
</TABLE>
<BR>
<BR>

</BODY>
</HTML>

Avatar of slok
slok

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.
Avatar of alanpong

ASKER

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
by EVERYONE , IUSR_XXX and SYSTEM.

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.

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
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?
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 !!
Hi,
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.
rgds.
alanpong
alanpong@hkstar.com

ASKER CERTIFIED SOLUTION
Avatar of hkp
hkp
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.

rgds.
alanpong
alanpong@hkstar.com