Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access ASP
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access ASP Using ASP with Microsoft Access databases. For Access questions not specific to ASP, please use the Access forum. For more ASP forums, please see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access ASP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 26th, 2004, 06:11 PM
Registered User
 
Join Date: Feb 2004
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Authentication failed

I'm trying to connect to an access database and I'm getting an Authentication failed error. At this point, I'm only trying to read the file.

What are the possible things that can cause this error?

Here's my code.
<%
Dim adOpenForwardOnly, adLockReadOnly, adCmdTable
adOpenForwardOnly = 0
adLockReadOnly = 1
adCmdTable = 2

Dim objConn, objRS
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")

Dim strDatabaseType
'Choose one of the following two lines, and comment out the other
strDatabaseType = "Access"
'strDatabaseType = "MSDE"

Dim strServerPath
Dim strOpenString

strServerPath = Server.MapPath("/data/Movie2000.mdf")
strOpenString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
             strServerPath
            

'Now we use this selection to open the connection in the appropriate way
If strDatabaseType = "Access" Then
objConn.Open strOpenString


Else
objConn.Open "Provider=SQLOLEDB;Persist Security Info=False;" & _
             "User ID=sa;Initial Catalog=Movie;" & _
             "Initial File Name=C:\MSSQL7\Data\Movie2000.mdf"
End If

objRS.Open "Movies", objConn, adOpenForwardOnly, adLockReadOnly, adCmdTable

While Not objRS.EOF
Response.Write objRS("Title") & "<BR>"
objRS.MoveNext
Wend

objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
%>
Reply With Quote
  #2 (permalink)  
Old February 27th, 2004, 05:19 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Your connection string is pointing to an mdf file rather than an mdb file.
Quote:
quote:
strServerPath = Server.MapPath("/data/Movie2000.mdf")
strOpenString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
               strServerPath
should be
Code:
strServerPath = Server.MapPath("/data/Movie2000.mdb")
strOpenString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
               strServerPath
If that was just a typo then make sure the IIS acount has read/write permission on the folder where the mdb is. (It needs write permission to create the ldb locking file)

--

Joe
Reply With Quote
  #3 (permalink)  
Old February 27th, 2004, 11:12 AM
Registered User
 
Join Date: Feb 2004
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I changed it to say mdb (can't believe I didn't notice that). I still get the authentication failed error. I'll have to check on the permissions.

Reply With Quote
  #4 (permalink)  
Old February 27th, 2004, 11:34 AM
Registered User
 
Join Date: Feb 2004
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

One other question. Will the locking file need to be created no matter what?

Reply With Quote
  #5 (permalink)  
Old February 27th, 2004, 12:16 PM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Anytime the database is accessed. If you have a standard set up of IIS you need to allow iusr_<machineName> permissions to the folder.



--

Joe
Reply With Quote
  #6 (permalink)  
Old February 27th, 2004, 01:29 PM
Registered User
 
Join Date: Feb 2004
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, this is going out on a commercial web server (not this exact code, this was just a test) and I don't have access to it to change permissions.

Reply With Quote
  #7 (permalink)  
Old February 27th, 2004, 02:33 PM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Well if they support asp they will either have an area where the account does have permissions, as this is a very common scenario, or they will have their own database available, maybe SQL server.

--

Joe
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
logon failed Rohit Ranjan Crystal Reports 1 February 28th, 2005 06:19 PM
LOGON FAILED! winnie1778 Crystal Reports 1 January 25th, 2005 04:28 AM
Logon failed. msrnivas .NET Web Services 3 January 24th, 2005 02:56 PM
SQL_HANDLE_ENV failed jescoint Classic ASP Databases 0 August 18th, 2003 03:56 AM



All times are GMT -4. The time now is 06:50 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.