DW database connection path what good _dreamweaver

Source: Internet
Author: User
Tags dreamweaver
Dreamweaver MX Dynamic Build Station database path using method

One, it is not recommended to use Server.MapPath (database file relative to document path address)

Although the platform portability, for different levels, different depths of the reference to the database files, will not fully guarantee the correctness of the database path.

As an example:

1, the database file Cnbruce.mdb, the Location folder database (can be HTTP access)
2,DW automatically generated connection database file conn.asp, folder connections
3, if you test the connection path successfully in DW, you must enter the address as Server.MapPath (". /database/cnbruce.mdb ")
But then the file that references the database connection must be saved in a folder that is the same as database

That


-Database
-Cnbruce.mdb
-Connections
-Conn.asp
-a folder
-X1.asp



This structure can be used normally. However, this must require that all files in the site that reference the connected database file must be stored in the first level directory of the site. Obviously this is unreasonable, such as the structure.



-X2.asp
-Database
-Cnbruce.mdb
-Connections
-Conn.asp
-a folder
-A subfolder
-X3.asp



Both x2.asp and x3.asp are not displayed properly.

Principle analysis: Regardless of where the conn.asp is placed, regardless of the content of conn.asp, ultimately depends on the file reference conn.asp file location and database location relationship. Specific explanation:http://www.cnbruce.com/blog/showlog.asp?cat_id=26&log_id=423

Solution: In conn.asp to determine the current path, according to different levels of values to give different link paths ... For beginners, trouble.
The second solution is to use the relative root directory method, but it is not recommended.

Two, it is not recommended to use Server.MapPath (database files relative to the root directory path)

With this approach, you first need to adjust the IIS default site to the folder (XP system) where the current DW site resides, or set up a site to point to the folder (2K, etc.).

Anyway, the word is when you enterhttp://localhost/, the content displayed is not the default IIS home page, but the default first page document in the DW site folder that you set up.

Then after you set up the IIS site

1, the database file Cnbruce.mdb, the Location folder database (can be HTTP access)
2,DW automatically generated connection database file conn.asp, folder connections
3, if test connection path succeeds in DW, enter address as Server.MapPath ("/database/cnbruce.mdb")

/database/cnbruce.mdbThis method is relative root directory, farsighted type of database path to obtain, no matter which level, which directory of the site documents can be normal display.

But still not recommended! The reasons are as follows:

In the local you can modify the IIS site, when uploaded to the server or virtual host, the trouble comes.

1, if your virtual host service technology is not clearance, when the root directory of your site is resolved, not to point to your site folder, but to the server system disk under the Wwwroot folder. So the path is definitely wrong.
2, if you need to upload is not your site root directory, it is obvious that the path will certainly be parsing errors.

Therefore, do not recommend ·! So, what should we do?

Third, the recommended use (local absolute physical path of the database file)

Quite simply, you'll always know where it is in the local database. This absolute physical path address is used directly in the DW when it is created.

OK, let's upload it. Of course not. The physical path address of the database uploaded to the server is the same as the physical path address of the local database-__-!

So now you just need to get the database file uploaded to the server space, and the physical address on the server is OK.

How do you get it?

1, create a path.asp file, the content is very simple


<%=server.mappath ("Cnbruce.mdb")%>


2, the file and database file Cnbruce.mdb, a total folder, bundled upload together.
3, in the URL address bar to view path.asp, get cnbruce.mdb Physical address on the server, copy the path.
4, will be the local conn.asp in the physical path, replace and then upload. Everything ok!

Characteristics:
1, although the platform porting is not very strong, but fully support all the site file connectivity, and also is the local and server between the two migration.
2, prevent%5c Bauku to obtain the database address indirectly.
3, more and more space is now recommended to put the database file into a non-Web Access directory, which requires the user to use the physical path.

So, my point is:

Dreamweaver MX Dynamic Build Station Database path use method:

local use Physical address, upload server still use physical address.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.