need help. cannot figureout how to connect to acce

Results 1 to 2 of 2

Thread: need help. cannot figureout how to connect to acce

  1. #1
    Join Date
    Dec 1969

    Default need help. cannot figureout how to connect to acce

    Hostcentric is my webhosting company & I can&#039;t figureout the correct connection string to connect to an Access database. I am thinking the best way for me to link would be to use the DSN-less connection type. <BR><BR>I&#039;ve read through & tried a bunch of tutorials but have had no success. This one seems the easiest to understand & the one I&#039;ll be referring too is faq2 on this website.<BR><BR>Step 1 says to put the .mdb database in a web shared directory. I am not sure what is meant by this exactly? I put the database in the root directory & can go the url of the database & thus open or dl it. Is this correct? Is there something else I need to do? Step 2 speaks of a driver & physical location of the file. I don&#039;t understand what driver they are talking about? I am thinking they mean the Access driver & I don&#039;t know which version of Access is on the server. As far as the physical location... thats an unknown also. All I know is the URL location of the file. I am not even sure what will happen when I do adventually make a connection to the database. My objective is to link to this database so I can write scipt to manipulate it.. retrieve data or input data & show it. I am anxious to begin learning how to use ASP & I am stuck here. I&#039;d appreciate any comments that might. Thanks in advance! <BR> <BR>

  2. #2
    Join Date
    Dec 1969

    Default Just to get started...

    ...put the .mdb file in the same directory as your ASP file(s).<BR><BR>Then use this:<BR><BR>Set conn = Server.CreateObject("ADODB.Connection")<BR>conn.Op en "Provider=Microsoft.Jet.OLEDB.4.0;" _<BR>&nbsp; &nbsp; &nbsp; &nbsp; & "Data Source=" & Server.MapPath("xxxxxx.mdb")<BR><BR>Where you replace the xxxxxx with the name of your DB.<BR><BR>This should certainly get you *at least* read-only access to the DB. If you can&#039;t write to it, it&#039;s probably becuz the directory with your ASP code is only writable via FTP.<BR><BR>Okay, not to panic. Ask the hosting company where you *SHOULD* put your DB.<BR><BR>On my son&#039;s host, when he FTPs to "his" site, he sees two top-level directories: "data" and "public_html". The latter is, not surprisingly, where he puts his HTML and ASP code. And anything else that needs to be accessed via a URL. The "data" directory is where he puts databases, read/write files, and the like. It can NOT be accessed via a URL, and so is reasonably safe from prying eyes.<BR><BR>So, in his case, if the DB was in<BR>&nbsp; &nbsp; dataxxx.mdb <BR>and the ASP code was in<BR>&nbsp; &nbsp; public_htmlshowdb.asp<BR><BR>then we could use<BR><BR>Set conn = Server.CreateObject("ADODB.Connection")<BR>conn.Op en "Provider=Microsoft.Jet.OLEDB.4.0;" _<BR>&nbsp; &nbsp; &nbsp; &nbsp; & "Data Source=" & Server.MapPath("..dataxxxxxx.mdb")<BR><BR>Do you see it? We are asking MapPath to "start at the current directory [public_html], go up one level, then down to the data directory, and then get the full path to xxxxxx.mdb."<BR><BR>Make sense?<BR><BR>

Posting Permissions

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