Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 26th, 2004, 06:11 PM
Registered User
 
Join Date: Feb 2004
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
%>
 
Old February 27th, 2004, 05:19 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
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
 
Old February 27th, 2004, 11:12 AM
Registered User
 
Join Date: Feb 2004
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.

 
Old February 27th, 2004, 11:34 AM
Registered User
 
Join Date: Feb 2004
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?

 
Old February 27th, 2004, 12:16 PM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
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
 
Old February 27th, 2004, 01:29 PM
Registered User
 
Join Date: Feb 2004
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.

 
Old February 27th, 2004, 02:33 PM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
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





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





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