There are 3 ways to connect Access database in Adobe Dreamweaver. And which way is the most efficient
1. Server.Mappath, the relative document path address database file.
Although the file had Platform portability, it could not completely ensure that the database path is correct, when the file of the database was referenced in different levels.
For example:
1. the database file cnbruce.mdb in the file folder database
2. The database conn.asp in the file folder Connections that are produced automatically by Adobe Dreamweaver CS3.
3. If the connection is tested to be successful in Adobe Dreamweaver, you had to input the address Server.Mappath (“…/database/cnbruce.mdb”).
But the referenced file that was to connect database must be stored in some folder,which is equal to database.
- database
- cnbruce.mdb
- Connections
- conn.asp
- some file folder
- x1.asp
It will go well in such a construction. But all of the referenced files that have connected to the database files are required to be stored in a directory of the sites. Obviously,that is not reasonable .
For example:
- x2.asp
- database
- cnbruce.mdb
- connections
- Conn. asp
- Some folder
- Some sub-folder
- x3.asp
The x2.asp and x3.asp both could not be displayed in that structure.
Because, wherever conn.asp is stored and whatever the content of conn.asp is, depend on the location of the file that referenced conn.asp file and the location of the database.
The resolution: determine the current path in conn.asp and then get the different link path according as the value of the different levels.
2. Server.Mappath, the database file of the Relative root directory path
Firstly,the ISS default site should be adjusted in the file where Adobe DreameaverCS3 is located ,or a site created will point .In a word, when you input the address http://localhost, the content displayed is not the homepage defaulted by IIS, and the default home document in the site folder of Adobe Dreamweaver.
1. the database file cnbruce.mdb in the file folder database
2. The database conn.asp in the file folder Connections that are produced automatically by Adobe Dreamweaver CS3.
3. If the connection is tested to be successful in Adobe Dreamweaver, you had to input the address Server.Mappath (“…/database/cnbruce.mdb”).
The method “/database/cnbruce.mdb” is that the relative root directories get the database path. And under this condition, all of the site documents could be displayed.
That way is not recommended .there are several reasons:
You can modify the local site .But the files are uploaded to the Server or Virtual Server, there are lots of troubles.
1. If your Web Hosting Service Provider is not so good at the technology, when parsing the root directory of your site, the path did not point to your site folder and to wwwroot folder under the server system disk. So there is a path error.
2. If what is required to upload is not your site root directory, obviously, the parse error in path will occur.
The third way: the local absolute physical path of the database file
You always know where the local database is located .In Adobe Dreamweaver CS3; the absolute physical path will be used when the database created. The physical path of the database uploaded to the Server is the same as that of the local one. So, you just get the database files uploaded to the Server space, whatever physical address the server is in. But, how can we get it?
1. Create a path.asp file.
2. This file and database file cnbruce.mdb are located in the same file folder, both of which bundled are uploaded at the same time.
3. View path.asp on the URL address bar, and get a physical address in the server and copy this path.
4. Replace that path of the physical address of the local conn.asp, and then upload the file.
In my opinion, the third way is best.