Link to home
Start Free TrialLog in
Avatar of Jason Yu
Jason YuFlag for United States of America

asked on

Can't using ODBC foxpro drive?

I tried to transfer my intranet website from an old server to a new one. I set up the IIS well and can open a testing page well. Then, I moved on and copied the whole website from the old machine to the new one. I use the same folder structure and same privilege. However, after I key in the new webserver's address 192.168.0.1, it can open the first login page. When I input my login information, it doesn't let me login. It gives error like this:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Visual FoxPro Driver]Cannot open file z:\common.dbc.

/signon.asp, line 57


The login page check with the background foxpro table for verification of username. The code is as below. I checked all the settings and mapped the data folder to my new server. it still doesn't work. I guess it's the connection between my new web server and my foxpro database server's communication has problems. and maybe the ODBC drive's issue(I indeed installed the ODBC drive on the new web server).

Please guys help me, I appreciate your help sincerely. I took over this position not long, the code was not written by myself. thanks.
<% option explicit %>
<!-- metadata type="typelib" file="c:\program files\common files\system\ado\msado25.tlb"-->
<!-- #include file="dbdef.asp" -->
<html>
 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Easy Life Furniture, Intranet Sign On</title>
</head>
 
<body bgcolor="#FFEBE3">
 
      <table border="0" width="80%" align="center" height="74">
        <tr>
          <td width="70" rowspan="2" height="70" valign="top"><img border="0" src="images/elf-logo.jpg" width="67" height="90"></td>
          <td  height="22"><font face="Tahoma"><b>Easy Life Furniture,
            Inc.</b></font></td>
        </tr>
        <tr>
          <td width="87%" height="44">
            <form method="POST" action="signon.asp">
            <table border="0" width="419" height="68">
              <tr>
                <td width="74" align="left" height="18"><i>User Name</i></td>
                <td width="331"><input type="text" name="txtUser" size="20">(same as
                  Myriad)</td>
              </tr>
              <tr>
                <td width="74" align="left" height="17"><i>Password</i></td>
                <td width="331" ><input type="password" name="txtPwd" size="20">(same
                  as Myriad)</td>
              </tr>
              <tr>
                <td width="74" align="left" height="21"></td>
                <td width="331" ><input type="submit" value="Submit" name="btnSubmit"></td>
              </tr>
            </table>
            </form>
            </td>
        </tr>
      </table>
      
<%
Dim strMyriadConn, strSQL, strDBPwd,strUIPwd,strErrorMsg
Dim objRS
Dim iLen,i
Dim chDB, chUI
 
session("uid")=""
session("ustore")=""
strErrorMsg="Signon failed"
 
if Request.Form("btnSubmit")<>"" then
	Set objRS=Server.CreateObject("ADODB.Recordset")
	strMyriadConn="DSN=Myriad"
	strSQL="select fullname,password,storeid,accesscosts from users where username=='" & UCase(Request.Form("txtUser")) & "' and lockuser=.F."
	objRS.Open strSQL, strMyriadConn, adOpenForwardOnly, adLockReadOnly,adCmdText
 
	if objRS.EOF then
		strErrorMsg="Invalid user !"
	else 
		strErrorMsg="Invalid password !"
		strDBPwd=trim(objRS("password"))
		strUIPwd=UCase(trim(Request.Form("txtPwd")))
		iLen=Len(strDBPwd)
		
		if iLen=Len(strUIPWD) then
		
			i=1
			chUI=asc(mid(strUIPwd,i,1))
			chDB=asc(mid(strDBPwd,i,1))
			
			do while i<=iLen and chUI+102=chDB
				i=i+1
				if i<=iLen then
					chUI=asc(mid(strUIPwd,i,1))
					chDB=asc(mid(strDBPwd,i,1))
				end if
			loop
			
			if i=iLen+1 then 
				session("uid")=UCase(Request.Form("txtUser"))
				session("ustore")=trim(objRS("storeid"))
				session("accesscosts")=objRS("accesscosts")
				session("manager")=mid(objRS("fullname"),1,2)
			end if
		end if
	end if
	
	objRS.Close
	set objRS=Nothing
 
	if session("uid")<>"" then
		'Response.Write "-" & session("uid") & "-<br>"
		'Response.Write "-" & session("accesscosts") & "-"
		if session("redir")="" then
			session("redir")="default.asp"
		end if
			
		if session("manager")="(D" then 
			session("redir")="deliveryreports.asp"
		end if
		
		Response.Redirect session("redir")
		'Response.Write session("redir")
 
	else
		Response.Write "Signon failed: " & strErrorMsg 
	end if	
end if
 
%>
      
 
</body>
 
</html>

Open in new window

error-code.JPG
SOLUTION
Avatar of JF0
JF0
Flag of United States of America 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
Avatar of Jason Yu

ASKER

still not working, same error as before. I use IIS 6 already.
SOLUTION
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
Yes, Z:\ is a shared folder, it's on my database server based on foxpro technology. But when I tried to ass ISUR_WebServer, it was listed there. I only add the account on the database server, not the accounts on the web server. Please see the print screen for detail.

About give the network path, you mean in ODBC settings interface? I am not sure where to change the path. Is it in ODBC settings or my asp code?
ERROR-PRINT-SCREEN.JPG
Thank you for your timely reply, I appreciate your help.
When I tried to compare the IIS settings of the new website with the old ones, I found the Server extension 2002 settings are different, is this a potential problem?
Server-Extensions-2002.JPG
I also found this page named dbdef.asp:

the code is as follows:
<%
Const ForReading = 1, ForWriting = 2, ForAppending = 8
 
Dim strConnect
'?
strConnect="Provider=SQLOLEDB.1;Persist Security Info=False;User ID=olapDB;Password=JRH3456;Initial Catalog=ELF-OLAP;Data Source=ELF-DBS"
 
'the following function for monthly report
function fmt(fld)
	if isnull(fld) then
		fmt="0"
	else
		fmt=fld
	end if
end function
 
'the following function for monthly report
function NBSPPad(fld)
 
	if isnull(fld) then
		NBSPPad="&nbsp;"
	else 
		if trim(fld)="" then
			NBSPPad="&nbsp;"
		else
			NBSPPad=fld
		end if
	end if
end function
 
'Verify log-on priviliage
sub VerifyUser(strRedirect,bHQOnly)				' verify if the user has been logged on
	Select Case bHQOnly
	
		Case "0"								'if not then redirect to sighon page
			if session("uid")="" then				
				session("redir")=strRedirect
				Response.Redirect "/signon.asp"
			end if
		Case "1"				' if the user is from the store and they are not store manager nor assistant manager then needs authorization
			if session("ustore")<>"00" and session("manager")<>"(S" and session("manager")<>"(A" then
				Response.Redirect "/Authorization.asp"
			end if
		Case "2"				' if the user is from the store and they are not store manager nor assistant manager nor customer service then needs authorizati
			if session("ustore")<>"00" and session("manager")<>"(S" and session("manager")<>"(A" and session("manager")<>"(O" then
				Response.Redirect "/Authorization.asp"
			end if
		Case Else
			session("redir")=strRedirect
			Response.Redirect "/signon.asp"
			
	End Select
 
end sub
 
function Percentage(p,base)				'calculate percentage
	if base>0.00 then
		Percentage=FormatNumber((100*p)/base,2)
	else
		Percentage="--"
	end if
end function
 
function RoundAdv(dVal, iPrecision)   ' round up for ASP
	Dim roundStr 
    Dim WholeNumberPart 
    Dim DecimalPart
    Dim i 
    Dim RoundUpValue 
    roundStr = CStr(dVal)
       
    If InStr(1, roundStr, ".") = -1 Then
        RoundAdv = dVal
        Exit Function
    End If
    if len(roundStr)>0 then 
        WholeNumberPart = Mid(roundStr, 1, InStr(1, roundStr, ".") - 1)
    	DecimalPart = Mid(roundStr, (InStr(1, roundStr, ".")))
    end if
    If Len(DecimalPart) > iPrecision + 1 Then
        Select Case Mid(DecimalPart, iPrecision + 2, 1)
            Case "0", "1", "2", "3", "4"
                DecimalPart = Mid(DecimalPart, 1, iPrecision + 1)
            Case "5", "6", "7", "8", "9"
                RoundUpValue = 0.1
                For i = 1 To iPrecision - 1
                    RoundUpValue = RoundUpValue * 0.1
                Next
                DecimalPart = CStr(CDbl(Mid(DecimalPart, 1, iPrecision + 1)) + RoundUpValue)
                If Mid(DecimalPart, 1, 1) <> "1" Then
                    DecimalPart = Mid(DecimalPart, 2)
                Else
                    WholeNumberPart = CStr(Cdbl(WholeNumberPart) + 1)
                    DecimalPart = ""
                End If
        End Select
    End If
    RoundAdv = CDbl(WholeNumberPart & DecimalPart)
    'If RoundAdv <> 0 Then
       'If negative And RoundAdv > 0 Then
          'RoundAdv = -1 * RoundAdv
       'End If
    'End If
    
 End Function
 
 
%>

Open in new window

SOLUTION
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
ASKER CERTIFIED SOLUTION
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
I guess you are using a DNS called Myriad. Change the DBC there to give the network path instead of the mapped name.

Also check if there is a zone for IIS setup. You can add that zone to the question if this doesn't solve it. Basically the IIS user needs read write rights to the folder where the data is kept.
Thank you tush for your timely reply.

I am not sure where I can change the DBC path, is it under the ODBC interface under administrative tools?

thanks.
Tried to change the path, it's the same. shows:


Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Visual FoxPro Driver]Cannot open file \\dell-2800\data\common.dbc.

/signon.asp, line 59


what zone are you talking about in the IIS?
IIS-settigns.JPG
You have given VFP and ASP as the zones for this question. There is also Microsoft - OS - Server - Microsoft IIS as a zone. Add it and maybe somebody there can help you out. This seems to be an IIS problem rather than a VFP one.
Get it, I will add Microsoft IIS in the zone list, so that people there can see this post too.

Thanks.
Avatar of cj_1969
You said this is a new server ... did you reinstall FoxPro?  I don't think FoxPro drivers are going to be part of a default Windows server install which means they will have to come from somewhere.

Another note ... typically ODBC (well, at least for MS Access) will not open a database that is not on the local server.  You should check and see if FoxPro has the same limitation ... if the database IS on the same server as IIS then this should not be a problem ... just thought I'd bring that up when I saw a reference to a UNC path.
Yes, it's a new server. I didn't install Foxpro program on this server although I have the edition 9.0 on hand. I just installed VFPODBC.msi 6.0 edition.

I am not sure the difference between VFPODBC and vfpoledb. I installed VFPODBC. The file size is about 895 KB. I downloaded it from Microsoft website.

No more help, please give me some hints about this.

Is this a IIS right issue or not?
SOLUTION
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
I got this issue solved with Microsoft Technet engineer.

The solution is as follows.

1. First, as cj1969 said, I indeed need the network parth like \\dell-2800\data\common.dbc instead of a mapped drive path.
2. Because I don't use domain account for accessing the database server, I need create the same account on both two servers, the web server and the database server, and use the same password with same privilege.
3. I need make sure the above account has the IUSER_Machinename privilege, that is mean I need give the account the same rights as described in this article. (microsoft expert sent me the article to me. http://support.microsoft.com/kb/812614. )

4. They used lot of tool to diagnose the problem, the website for download these tools is
http://live.sysinternals.com/ and http://technet.microsoft.com/en-us/sysinternals/default.aspx   for reference.

5. Tools they used are as follows:
Procmon.exe,
CompChecker
Test.udl connection testing file.


Although my company paid the money for this issue, I am happy with it. Because I know the issue and solved.

Thanks all guys here for posting.
Here is the script for getting the password for IUSER_machinename account.


Microsoft Windows [Version 5.2.3790]
(C) Copyright 1985-2003 Microsoft Corp.

C:\Documents and Settings\Administrator>cd\

C:\>cd Inetpub\AdminScripts

C:\Inetpub\AdminScripts>cscript adsutil.vbs get anonymoususer
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.


ErrNumber: -2147463164 (0x80005004)
Error Trying To GET the Schema of the property: IIS://localhost/Schema/anonymous
user

C:\Inetpub\AdminScripts>cscript adsutil.vbs get w3svc/anonymoususer
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.


ErrNumber: -2147463164 (0x80005004)
Error Trying To GET the Schema of the property: IIS://localhost/Schema/anonymous
user

C:\Inetpub\AdminScripts>cscript adsutil.vbs get w3svc/anonymoususername
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

anonymoususername               : (STRING) "WEBSERVER\test"

C:\Inetpub\AdminScripts>cscript adsutil.vbs get w3svc/anonymoususerpass
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

anonymoususerpass               : (STRING) "**********"

C:\Inetpub\AdminScripts>cscript adsutil.vbs get w3svc/anonymoususerpass
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

anonymoususerpass               : (STRING) "test"

C:\Inetpub\AdminScripts>cscript adsutil.vbs find anonymoususername
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

Property anonymoususername found at:
  MSFTPSVC
  W3SVC
  W3SVC/1/ROOT

C:\Inetpub\AdminScripts>cscript adsutil.vbs get w3svc/1/anonymoususerpass
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

The parameter "anonymoususerpass" is not set at this node.

C:\Inetpub\AdminScripts>cscript adsutil.vbs get w3svc/1/root/anonymoususerpass
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

anonymoususerpass               : (STRING) "test"
How to focefully apply local group policy settings without restaring.


Microsoft Windows [Version 5.2.3790]
(C) Copyright 1985-2003 Microsoft Corp.

C:\Documents and Settings\Administrator>gpupdate \f
Microsoftr Windowsr Operating System Group Policy Refresh Utility v5.2
c Microsoft Corporation. All rights reserved.

Description:  Refreshes Group Policies settings.

Syntax:  GPUpdate [/Target:{Computer | User}] [/Force] [/Wait:<value>]
     [/Logoff] [/Boot] [/Sync]

Parameters:

Value                      Description
/Target:{Computer | User}  Specifies that only User or only Computer
                            policy settings are refreshed. By default,
                            both User and Computer policy settings are
                            refreshed.

/Force                     Reapplies all policy settings. By default,
                            only policy settings that have changed are
                            applied.

/Wait:{value}              Sets the number of seconds to wait for policy
                            processing to finish. The default is 600
                            seconds. The value '0' means not to wait.
                            The value '-1' means to wait indefinitely.
                            When the time limit is exceeded, the command
                            prompt returns, but policy processing
                            continues.

/Logoff                    Causes a logoff after the Group Policy settings
                            have been refreshed. This is required for
                            those Group Policy client-side extensions
                            that do not process policy on a background
                            refresh cycle but do process policy when a
                            user logs on. Examples include user-targeted
                            Software Installation and Folder Redirection.
                            This option has no effect if there are no
                            extensions called that require a logoff.

/Boot                      Causes a reboot after the Group Policy settings
                            are refreshed. This is required for those
                            Group Policy client-side extensions that do
                            not process policy on a background refresh cycle
                            but do process policy at computer startup.
                            Examples include computer-targeted Software
                            Installation. This option has no effect if
                            there are no extensions called that require
                            a reboot.

/Sync                      Causes the next foreground policy application to
                            be done synchronously. Foreground policy
                            applications occur at computer boot and user
                            logon. You can specify this for the user,
                            computer or both using the /Target parameter.
                            The /Force and /Wait parameters will be ignored
                            if specified.


C:\Documents and Settings\Administrator>gpupdate /f
Microsoftr Windowsr Operating System Group Policy Refresh Utility v5.2
c Microsoft Corporation. All rights reserved.

Description:  Refreshes Group Policies settings.

Syntax:  GPUpdate [/Target:{Computer | User}] [/Force] [/Wait:<value>]
     [/Logoff] [/Boot] [/Sync]

Parameters:

Value                      Description
/Target:{Computer | User}  Specifies that only User or only Computer
                            policy settings are refreshed. By default,
                            both User and Computer policy settings are
                            refreshed.

/Force                     Reapplies all policy settings. By default,
                            only policy settings that have changed are
                            applied.

/Wait:{value}              Sets the number of seconds to wait for policy
                            processing to finish. The default is 600
                            seconds. The value '0' means not to wait.
                            The value '-1' means to wait indefinitely.
                            When the time limit is exceeded, the command
                            prompt returns, but policy processing
                            continues.

/Logoff                    Causes a logoff after the Group Policy settings
                            have been refreshed. This is required for
                            those Group Policy client-side extensions
                            that do not process policy on a background
                            refresh cycle but do process policy when a
                            user logs on. Examples include user-targeted
                            Software Installation and Folder Redirection.
                            This option has no effect if there are no
                            extensions called that require a logoff.

/Boot                      Causes a reboot after the Group Policy settings
                            are refreshed. This is required for those
                            Group Policy client-side extensions that do
                            not process policy on a background refresh cycle
                            but do process policy at computer startup.
                            Examples include computer-targeted Software
                            Installation. This option has no effect if
                            there are no extensions called that require
                            a reboot.

/Sync                      Causes the next foreground policy application to
                            be done synchronously. Foreground policy
                            applications occur at computer boot and user
                            logon. You can specify this for the user,
                            computer or both using the /Target parameter.
                            The /Force and /Wait parameters will be ignored
                            if specified.


C:\Documents and Settings\Administrator>gpupdate /force
Refreshing Policy...

User Policy Refresh has completed.
Computer Policy Refresh has completed.

To check for errors in policy processing, review the event log.


C:\Documents and Settings\Administrator>