Database Connectivity

Discussion in 'ASP General' started by MROPARTNER, Dec 27, 2004.

  1. MROPARTNER

    MROPARTNER Guest

    Microsoft has a tutorial for ASP. There is a connection string in the
    code
    as follows:

    DBQ=C:\Inetpub\Wwwroot\Tutorial\guestbook.mdb;"\

    How do I change this statement once I move the page to my web server?
    I
    have the database in my root folder.


    Thanks
     
    MROPARTNER, Dec 27, 2004
    #1
    1. Advertisements

  2. Try using this, both locally and remotely:

    Dim sConnectionString
    sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
    Server.MapPath("/tutorial/guestbook.mdb")

    Note that unless you've configured IIS so that read-access is denied to that
    file or directory via HTTP, anyone in the world can download your database.
    (Assuming that directory is a WWW-published directory.)

    Ray at work
     
    Ray Costanzo [MVP], Dec 27, 2004
    #2
    1. Advertisements

  3. MROPARTNER

    Jeff Cochran Guest

    As an explanation, Server.MapPath finds the actual physical path on
    the system to the file beginning at the root of the web. So if your
    file was physically at:

    c:\inetpub\wwwroot\subfolder1\application\database.mdb

    and your site's root was at:

    c:\inetpub\wwwroot\

    then the MapPath argument would be:

    ("/subfolder1/application/database.mdb")

    Using MapPath ensure that the structure of your web site is followed,
    no matter where the root of your site happens to be on the server.
    Your ISP could have your root at H:\Webroots\BasicHostingPlans\Bob\
    and as long as your structure of your site is the same as on your
    home/development system you don't need to change the code.

    Jeff
     
    Jeff Cochran, Dec 27, 2004
    #3
  4. MROPARTNER

    MROPARTNER Guest

    Jeff,

    Do you offer consulting (tech support) by the hour? If so what is your
    fee?

    Thanks
     
    MROPARTNER, Dec 28, 2004
    #4
  5. MROPARTNER

    Jeff Cochran Guest

    Contact me via email at:

    jeff at zina dot com

    Jeff
     
    Jeff Cochran, Dec 29, 2004
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.