SitePoint Sponsor

User Tag List

Results 1 to 11 of 11

Thread: asp+access help

  1. #1
    SitePoint Zealot
    Join Date
    Jul 2000
    Posts
    102
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i'm attempting to use asp to pull information out of a database and stick it into html. i'm trying to connect to a database that is on a different server than the website. i've been told by people that they think this is possible, though they are not sure. the code i'm using does not seem to work. here is the exact code i'm using, aside from my real IP address:

    <%@ Language=VBScript %>
    <% Option Explicit %>
    <!--#include virtual="adovbs.inc" -->
    <%
    Dim objConn
    Set objConn = Server.CreateObject("ADODB.Connection")
    objConn.ConnectionString="DRIVER={Microsoft Access Driver (*.mdb)};" & _
    "DBQ=D:\123.456.78.90\asp\JobsTest.mdb"
    objConn.Open

    Dim objRS
    Set objRS = Server.CreateObject("ADODB.Recordset")
    objRS.Open "Jobs", objConn, , , adCmdTable

    Do While Not objRS.EOF
    Response.Write "<b>" & objRS("JobNumber") & "</b><br>"
    Response.Write objRS("Specialty") & "<br>"
    Response.Write objRS("Location") & "<br>"
    Response.Write objRS("Description") & "<br>"
    Response.Write objRS("Contact") & "<p><hr><p>"


    objRS.MoveNext
    Loop


    objRS.Close
    Set objRS = Nothing

    objConn.Close
    Set objConn = Nothing
    %>

    does that look correct?

    this is the asp error i get:

    Microsoft OLE DB Provider for ODBC Drivers error '80004005'

    [Microsoft][ODBC Microsoft Access Driver] Disk or network error.

    /displayjobs.asp, line 9

    any and all help is appreciated.

    thanks.


  2. #2
    SitePoint Wizard
    Join Date
    Apr 2000
    Posts
    1,483
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You have the path for the database on the server's D: drive - are you sure that is the right path?
    Rather than report a Database Not Found error, the server did a Disk Error, which may mean that the server doesn't even have a D: drive. You should ask your host what the absolute path to the sites is.

    ------------------
    James Ussher-Smith, jamesus@lineone.net
    ICQ: 41716548
    640 Kilobytes of computer memory ought to be enough for anybody. - Bill Gates, 1981

    [This message has been edited by James (edited August 09, 2000).]

  3. #3
    SitePoint Zealot
    Join Date
    Jul 2000
    Posts
    102
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i know the database is on an NT server. i assume the website is, i'm not sure, i'll have to check with the isp.

    so essentially i should place this in my code: "DBQ=Z:\asp\jobstest.mdb"

    then i should have the isp map drive z or whatever drive and directory they want to use to my server with the database? that way the asp thinks its getting a local file on the webserver but the webserver is grabbing it from my server?

    also:

    "For security reasons and data integrity, I recommend against ever placing a database on the application or webserver."

    so what i'm trying to do is a good thing, then? or am i misunderstanding?

    thanks for all your help!

  4. #4
    SitePoint Wizard
    Join Date
    Apr 2000
    Posts
    1,483
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If the website is able to run ASP, then the server does run Windows NT.
    You are right that you should be putting in "DBQ=Z:\asp\jobtest.mdb" - assuming the drive is mapped OK that should work fine.
    It is a good idea to keep the database on a different server - that means two things:
    <UL TYPE=SQUARE>
    <LI> The database is not (usually) accessible from the web except through the ASP
    <LI> If one server gets a virus or something it won't affect the other one
    </UL>




    ------------------
    James Ussher-Smith, jamesus@lineone.net
    ICQ: 41716548
    640 Kilobytes of computer memory ought to be enough for anybody. - Bill Gates, 1981

  5. #5
    SitePoint Zealot
    Join Date
    Jul 2000
    Posts
    102
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    "If the website is able to run ASP, then the server does run Windows NT."

    right. i suppose it's possible they could be using chilisoft or something though.

    "You are right that you should be putting in "DBQ=Z:\asp\jobtest.mdb" - assuming the drive is mapped OK that should work fine."

    great. now i just need to get the admin to have the isp take care of that.

    "It is a good idea to keep the database on a different server - that means two things:
    <UL TYPE=SQUARE>
    <LI> The database is not (usually) accessible from the web except through the ASP
    <LI> If one server gets a virus or something it won't affect the other one
    </UL>"

    that was kind of my thinking the entire time. but every single tutorial or book i have read always gives the examples based on running either PWS or NT server with the asp pages and database on one machine. this makes total sense for quick testing but i just couldn't understand why none of them ever covered how to do this stuff in the real world.

    you guys have been loads of help! thanks!

  6. #6
    SitePoint Zealot
    Join Date
    Jul 2000
    Posts
    102
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the database is on a server here in our offices. the admin told me it was on the d drive. is there a reason why he might think its on d when in fact its not? also, does that appear to be the main problem? the drive is incorrect? or could it be something else?

    thanks a lot.

  7. #7
    SitePoint Zealot
    Join Date
    Jul 2000
    Posts
    102
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok. just playing around i changed the drive to a few other settings. as drive D, the original setting, i get this error message:

    Microsoft OLE DB Provider for ODBC Drivers error '80004005'

    [Microsoft][ODBC Microsoft Access Driver] Disk or network error.

    /displayjobs.asp, line 9

    changing the drive to C or E gives me this:

    Microsoft OLE DB Provider for ODBC Drivers error '80004005'

    [Microsoft][ODBC Microsoft Access Driver] '(unknown)' is not a valid path. Make sure that the path name is spelled
    correctly and that you are connected to the server on which the file resides.

    /displayjobs.asp, line 9

    does this indicate anything?

    thanks!

  8. #8
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Error
    "DBQ=D:\123.456.78.90\asp\JobsTest.mdb"

    Solution
    You can't use an IP address like this here. You must confirm to standard Networking protocols. Map the remote drive to say z: on your web server machine and change the directory to "z:\asp\jobstest.mdb"


    ------------------
    Wayne Luke - Sitepoint Forums Administrator
    Digital Magician Magazine - MetaQuark Creations (Coming Soon)
    sitepoint@digitalmagician.com

    [This message has been edited by wluke (edited August 10, 2000).]

    [This message has been edited by wluke (edited August 10, 2000).]

  9. #9
    SitePoint Zealot
    Join Date
    Jul 2000
    Posts
    102
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok. but the database is not on the webserver. is it possible to connect to an access database that's not on the webserver? some people say yes. some say no. i'm sure there's a simple answer. is it possible?

    thanks.

  10. #10
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Your webserver is on NT yes? The database is on NT yes?

    If you map the drive on your server, for all intents and purposes the database is on the server. The database doesn't have to reside on the server machine. For security reasons and data integrity, I recommend against ever placing a database on the application or webserver.

    ------------------
    Wayne Luke - Sitepoint Forums Administrator
    Digital Magician Magazine - MetaQuark Creations (Coming Soon)
    sitepoint@digitalmagician.com

  11. #11
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    In the real world you have System Admins and Database Administrators who handle this for you. Trust me, when I say that our DBA is not going to let me touch his $1.5 million Oracle machines (there are 2 so far) even if I have the best of intentions.

    ------------------
    Wayne Luke - Sitepoint Forums Administrator
    Digital Magician Magazine - MetaQuark Creations (Coming Soon)
    sitepoint@digitalmagician.com


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
  •