Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 737
  • Last Modified:

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>

0
alanpong
Asked:
alanpong
1 Solution
 
slokCommented:
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.
0
 
alanpongAuthor Commented:
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.

0
 
kinggsCommented:
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
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
alanpongAuthor Commented:
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?
0
 
kinggsCommented:
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 !!
0
 
alanpongAuthor Commented:
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

0
 
hkpCommented:
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.

0
 
alanpongAuthor Commented:
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

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now