Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2004
    Location
    Vancouver
    Posts
    17

    Unanswered: problem with password protected DB and ASP

    Help!
    I password protected an ACCESS DB. However now when i try to access any of my .asp pages that link to the database i am getting the following error.
    Code:
    Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
    [Microsoft][ODBC Microsoft Access Driver] Not a valid password.
    Obviously it is looking for a password before it accesses my database. Is there anyway around this? I would like to keep my DB password protected, unless someone can suggest some other form of security where i can keep users out of the actual database itself (ie. not able to open it in Access), but still allow them to enter and view data via my asp pages.
    still in the baby steps of coding

  2. #2
    Join Date
    Apr 2004
    Posts
    50
    All you need to do is to put your Access database outside of the root folder of your website. This way the database won't be accessible for the users browsing the site.

  3. #3
    Join Date
    Feb 2004
    Location
    Vancouver
    Posts
    17
    on my server i do have the database outside the root of my website.

    I am running IIS on WinXp and have my web pages located at c:\inetpub\wwwroot\databases\mydatabase.mdb

    my asp pages are at c:\inetpub\wwwroot\asp\attendance folder

    or do you mean to move my DB completely out of the wwwroot...... folder?
    still in the baby steps of coding

  4. #4
    Join Date
    Apr 2004
    Posts
    50
    If your Access db is password protected, you can put the password into your connection string and then you'll be able to open your database from your ASP application.

    Putting your Access databases outside of the root of your web application, will make the db inaccessible for download for your website visitors.

    I hope this helps.

  5. #5
    Join Date
    Feb 2004
    Location
    Vancouver
    Posts
    17
    OK, i understand the concept, but how would i code in a password below. Sorry my coding abilities are still rather novice. I am using a DSN connection
    Code:
    <%
    Set conn = Server.CreateObject("ADODB.Connection")
        conn.open "attendance2004","",""
        sql = "SELECT [staff].[fullname], [staff].[employeeno] FROM [staff] ORDER BY [staff].[fullname];"    
        Set rs = Server.CreateObject("ADODB.Recordset")    
        rs.Open sql, conn, 3, 3    
    %>
    I did a search on google for some examples and i found one on ASP101.com, but couldnt get it too work.
    still in the baby steps of coding

  6. #6
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    Your connection string should look like:

    "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=accessDB.mdb;Password=whatever;"
    That which does not kill me postpones the inevitable.

  7. #7
    Join Date
    Dec 2003
    Posts
    454
    Dim Conn
    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.Open "DSN=MyDSN"; UserID=MyUserID; pwd=MyPassword"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •