Solved

Permission to access the database file in network driver through Web

Posted on 1998-03-21
8
711 Views
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?
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
Comment
Question by:alanpong
8 Comments
 
LVL 3

Expert Comment

by:slok
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.
0
 
LVL 1

Author Comment

by:alanpong
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
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
 

Expert Comment

by:kinggs
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
0
 
LVL 1

Author Comment

by:alanpong
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?
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Expert Comment

by:kinggs
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 !!
0
 
LVL 1

Author Comment

by:alanpong
ID: 1858050
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
 
LVL 3

Accepted Solution

by:
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.

0
 
LVL 1

Author Comment

by:alanpong
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.

rgds.
alanpong
alanpong@hkstar.com

0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Uploading files to the web server has become common part of almost any kind of web application. People use different technologies to solve this, but regardless of the technology used, it is always useful to have some kind of progress indicator shown…
I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now