SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Dec 2001
    Location
    Boston, MA
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    can't connect...

    Hi.
    I've been trying to connect to a simple access database on my IIS server (in house) through ASP but can't connect. I know this is supposed to be the easy part but it's starting to eat away at me. I've tried creating a DSN and now a DSNless connection. I've tried a bunch of different scripts but no luck.
    This is the one I'm trying now:

    <html>
    <head>
    <title>Trial ASP</title>
    </head>
    <body bgcolor="#FFFFFF" text="black">
    <%
    Dim adoCon
    Dim rsNames
    Dim strSQL

    Set adoCon = Server.CreateObject("ADODB.Connection")
    adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("odbc_exmp.mdb")

    Set rsNames = Server.CreateObject("ADODB.Recordset")

    strSQL = "SELECT tblNames.first_name, tblNames.last_name FROM tblNames;"

    rsNames.Open strSQL, adoCon

    Do While not rsNames.EOF

    Response.Write ("<br>")
    Response.Write (rsNames("first_name"))
    Response.Write ("<br>")
    Response.Write (rsNames("last_name"))
    Response.Write ("<br>")

    rsNames.MoveNext

    Loop

    rsNames.Close
    Set rsNames = Nothing
    Set adoCon = Nothing
    %>

    </body>
    </html>

    I get this error:

    Microsoft OLE DB Provider for ODBC Drivers error '80004005'

    [Microsoft][ODBC Microsoft Access 97 Driver] Can't open database '(unknown)'. It may not be a database that your application recognizes, or the file may be corrupt.

    /DB/names.asp, line 12

    Any help? I would appreciate it very much. Thank you.

  2. #2
    I have an opinion...
    Join Date
    Sep 2001
    Location
    Barrie, Ontario
    Posts
    324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check the driver version and your database version. It may be a mix of Access 97 and Access 2k, which does funny things sometimes.

    Other option is to use the Jet driver instead of the Access driver.

    Code:
    Set objConnect = Server.CreateObject( "ADODB.Connection" )
    objConnect.Open( "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath( "/include/dbDatabase.mdb" ) )
    Egotist: A person more interested in himself than in me.
    KodeKrash - Eidix - Barrie LUG

  3. #3
    SitePoint Member
    Join Date
    Dec 2001
    Location
    Boston, MA
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your help. I tried changing to the Jet Driver:

    Set adoCon = Server.CreateObject("ADODB.Connection")
    adoCon.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("odbc_exmp.mdb"))

    But got this error:

    ADODB.Connection error '800a0e7a'

    ADO could not find the specified provider.

    /DB/names.asp, line 12

    Any ideas? I'm kind of new to this stuff, please bear with me. Thank you very much.

  4. #4
    I have an opinion...
    Join Date
    Sep 2001
    Location
    Barrie, Ontario
    Posts
    324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You don't have the Jet driver installed. I recommend installing both MDAC 2.6 and Jet 4. You can get the files from MS UDA Downloads. These are good to install anyway, since they fix a couple database connection security "features".
    Last edited by KodeKrash; Dec 31, 2001 at 15:16.
    Egotist: A person more interested in himself than in me.
    KodeKrash - Eidix - Barrie LUG

  5. #5
    SitePoint Member
    Join Date
    Dec 2001
    Location
    Boston, MA
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you. one more question...do i install that on the server or locally? the database and asp file are on my iis server that is in house.
    thanks again.

  6. #6
    I have an opinion...
    Join Date
    Sep 2001
    Location
    Barrie, Ontario
    Posts
    324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Install it on the server.
    Egotist: A person more interested in himself than in me.
    KodeKrash - Eidix - Barrie LUG


Bookmarks

Posting Permissions

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