Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WinXP Pro and IIS problem 1

Status
Not open for further replies.

karmafree

Programmer
May 10, 2001
107
0
0
GB
Hey,

The below "INSERT INTO" code used to work fine with my Win98 computer running Personal Web Server. Now I've ported it to a WinXP Pro computer running IIS and get the following error:


Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.
/MySite/MyScript.asp, line 18

Here is the code:

<%
Dim sql, connection, dsn

ID = Request.Form(&quot;txtID&quot;)
Name = Request.Form(&quot;txtName&quot;)
Age = Request.Form(&quot;txtAge&quot;)

sql = &quot;&quot;
sql = sql & &quot;INSERT INTO MyTable (id, name, age)&quot;
sql = sql & &quot;VALUES ('&quot;& ID &&quot;', '&quot;& Name &&quot;', '&quot;& Age &&quot;');&quot;

Set connection = Server.CreateObject(&quot;ADODB.Connection&quot;)
dsn = &quot;DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=&quot; & Server.MapPath(&quot;MyDatabase.mdb&quot;)

connection.Open dsn
connection.Execute(sql) ' This is the error line 18
connection.Close

Set connection = Nothing

response.redirect(&quot;thanks.asp&quot;)
%>

Thank you,
karmafree.

 
Hello!

Verify DSN settings from ODBC (is it pointing the correct database with correct user name and password.


I guess it is due to DSN configuration there is no such error in Windows XP.

I hope this will help. iis_guru@yahoo.com
 
This error is typically encountered when you try to modify some data in a access database using ADO. Perform a modify with UPDATE or some other action like that.

there are a lot of reasons because this happens but none of but none of these depends particularly on Windows XP.

maybe you have't set write permission on the DB file, IIS user, (typically IUSR_MACHINE), must be able to write in the folder that contains Access MDB file.

Another cause of this error is that the database was not opened with the correct MODE for writing.

Microsoft Example:

SQL = &quot;UPDATE Products Set UnitPrice = 2;&quot;
Set Conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
Conn.Mode = 3 '3 = adModeReadWrite
Conn.Open &quot;myDSN&quot;
Conn.Execute(SQL)
Conn.Close

Another cause of this error is that the &quot;Read Only&quot; setting may be checked in the Options page for this DSN in the ODBC Manager, if you used that.

bye

Silke P.



 
Hello KarmaFree

Were you ever able to solve the problem you described ?
I am experiencing the same problems and have had no luck writing or updating a database with IIS 5.1 running on an XP Pro machine.

I have confirmed the names (spelling) and paths in the ODBC administrator app and have set all IIS properties to Read Write and Execute. The database has no security on it. The same database and code works on 98 and ME editions of Windows running PWS.

I tried the suggestions in response to your thread but still no luck. If you were able to fix it ... perhaps you could post your fix here ?

Thanks in advance
Kevin
 
Hi Kevin,

I've still no luck in making it work
and I'm still using PWS on Win98.
I really have no clue why we are
getting these errors, it's so
fustrating. I think MS have designed
the new XP IIS system to work with only
ASP.NET or something and are trying to
phase out the old. If you ever find a
fix for it, please keep me posted.
Sometimes, it does work, but then it
stalls again, I don't why this is.
Until then, it's PWS and Win98.

Thanks,
Steve.
 
Hi Karmafree

I thought I would let you know that Silke P. (Thank you Silke) was on the right track and that after making some modifications to the User Permissions and Web Site Properties that I am now able to write to my databases. Here is a list of what I did:

1. From the Computer Management Utility (Administration Tools) I selected Properties under Internet Information Services ... Web Sites and changed Home Directory Application Settings Execute Permissions from None to Scripts Only. I left all other settings at this level set as per default / installed.
2. I confirmed that Web Sites Authentication Methods under Web Sites Directory Security was set to IUSR_MachineName.
3. Again from the Computer Management Utility I selected Groups under the Local Users and Groups. I added both IUSR_MachineName and IWAM_MachineName as members of the Guest Account.
4. From Computer Management Utility I selected Users and confirmed that Guest Account was a member of the Guest account. (I realize that seems strange but we are talking about Microsoft here so better safe then sorry). I also made sure that both IUSR_MachineName and IWAM_MachineName Accounts were both members of Guests and Users. I also changed the Guest Account from disabled to enabled.
5. While still in the Computer Management Utility I right clicked on each folder that contained my problem databases and then under All Tasks I ran the Permissions Wizard. I chose Inherit all security settings and Public Web. This changed the folders so that Anonymous users could read and write to files.
6. I then rebooted the computer to ensure that all changes took effect.
7. When adding new folders and databases I simply run the Permissions Wizard as described above on both the new folder that contains the database (so it can create the temporary .ldb file) and the database itself. I am then able to execute read and write commands.

I am far from an expert on issues concerning security and IIS but I would imagine that Microsoft is likely between a rock and a hard place. They are expected to provide the kind of security that will prevent malicious writing to files while at the same time they are expected to provide anonymous users the flexibility to write to files. Personally I am not so sure the two can coexist and would surmise that Microsoft has set the install of IIS 5.1 to simply default to the most secure options. That would be to allow no writing to files. Anyway I do hope that this information can be of help to you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top