In the GMU Robinson 3rd floor classroom, there are two problems working with dynamic sites with Dreamweaver MX:
With regard to the first issue, in the absence of IIS, one must rely on the use of a remote server. www.brinkster.com provides web space where one can host ASP applications; this hosting is free for educational users. However, one cannot FTP to the free site but must use Brinkster's web-based file manager and thus one cannot use brinkster.com as a testing server in Dreamweaver MX because the connection is established via FTP. The Mason server (mason.gmu.edu) and the NVCC student server also do not support ASP pages, but the NVCC Faculty server does.
With regard to the DSN issue, using the MapPath method of the Server object is my recommended alternative. This is discussed in the Third Edition of Internet & World Wide Web How to Program by Deitel, Deitel, and Goldberg (p. 828-829) and the Dreamweaver MX help under "Virtual Path" and the "related topics" referenced therein, especially "Using a virtual path to connect to a database." Understanding the use of this method requires understanding the difference between a virtual path and a physical path. For example, in the URL www.deitel.com/books/index.html, books/index.html is the virtual path to the file located on the web server hosting www.deitel.com. The physical path refers to the actual location of the file on the machine running the server and will reference the drive letter. When one connects to a database through the use of a connection string rather than the use of a DSN, the physical path to the database is required. This presents two problems. First, in many hosting situations, the web developer has no idea of the physical location of the database. Second, even if this location is known, the location will change when the file is transferred from the local site to the remote site and thus the connection string must be changed as well for the remote site which is contrary to the usual web development principle whereby files can be transferred from the local site to the remote site unchanged and they will work in both locations.
The MapPath method of the Server object takes as an argument the virtual path and returns the corresponding physical path as a string, and thus the MapPath method can be used in the connection string to provide the needed physical path to the database which solves both of the problems above - knowing the physical path and having different code in the local and remote site due to the difference in the physical path to the database.
It is unclear in my view whether the Dreamweaver help screens suggest using the MapPath method directly when asked to enter a connection string in the following dialog box that one gets by clicking the + sign on the Databases Panel>Custom Connection String, selecting either the Using Driver on Testing Server or Using Driver on This Machine option.
My attempts to do so did not work. The VB Script version of the connection string used was
"Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("/db/login.mdb")
A better approach would be to replace the Server.MapPath expression in this dialog box with the physical path on the local machine. In my tests, one could enter a relative path to the file rather than an expression beginning with a drive letter. In any event, using such a local connection will enable the connection to be made, and then the connection string can be replaced with a MapPath expression before uploading to the server. Alternatively, one can upload an ASP file to the testing server with the following expression:<% Response.Write(Server.MapPath("/db/login.mdb")) %> where one replaces "/db/login.mdb" with the logical path to your database. This will display on the screen the physical path on the testing server and then one can use this in the connection string expression above, i.e. DBQ=physical path but this will mean that one has to again change the connection string when the file is moved to the production server, whereas using the MapPath method avoids that.
Revised: December 14, 2004. Comments to William Pegram, wpegram@nvcc.edu