Code for connecting to the SQLServer database in Dreamweaver

Source: Internet
Author: User
Tags web hosting
AdobeDreamweaverCS3 connects to the ACCESS database Driver {MicrosoftAccessDriver (*. mdb)}; UServer. mapPath (datadb1.mdb) AdobeDreamweaverCS3 connects to the SQLServer database PROVIDERSQLOLEDB; DATASOURCE (local); UIDsa; PWD the password when installing SQL; D

Adobe Dreamweaver CS3 connection to ACCESS database "Driver = {Microsoft Access Driver (*. mdb)}; Uid =; Pwd =; DBQ = "Server. mapPath ("/data/db1.mdb") Adobe Dreamweaver CS3 connect to the SQL Server database "PROVIDER = SQLOLEDB; DATA SOURCE = (local); UID = sa; PWD = the password when you Install SQL; D


Adobe Dreamweaver CS3 connection to ACCESS database

"Driver = {Microsoft Access Driver (*. mdb)}; Uid =; Pwd =; DBQ =" & Server. MapPath ("/data/db1.mdb ")


Adobe Dreamweaver CS3 connecting to SQL Server database

"PROVIDER = SQLOLEDB; data source = (local); UID = sa; PWD = password when you Install SQL; DATABASE = your DATABASE name"

Other references:

Adobe Dreamweaver CS3 has several methods to connect to the ACCESS database, including the relative path and absolute path. But what kind of connection method is the most efficient?

First: the database file of Server. Mappath relative file path

Although the platform is portable, the correctness of the database path cannot be completely guaranteed for files that reference the database at different levels and depths.

For example:

1. The database file cnbruce. mdb is located in the database folder (accessible through http)

2. Adobe Dreamweaver CS3 automatically generates the Connection database file conn. asp, And the Connections folder.

3. If the connection path is successfully tested in Adobe Dreamweaver CS3, you must enter the address Server. Mappath ("../database/cnbruce. mdb ")

However, the files that reference the database connection must be saved in a folder, which is the same as the database.

-Database-cnbruce. mdb-Connections-conn. asp-a folder
-X1.asp

This structure can be used normally. However, this requires that all files that reference database files in the site 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

X2.asp and x3.asp cannot be displayed normally.

Principle Analysis: No matter where conn. asp is put, regardless of the content of conn. asp, it depends on the file location of the file referenced by conn. asp and the location relationship of the database.

Solution: determine the current path in conn. asp and provide different link paths according to different levels of values ...... It is troublesome for beginners.

Type 2: database files in the root directory of Server. Mappath

To use this method, you must first adjust the default IIS Site to the folder where the current Adobe Dreamweaver CS3 site is located (XP system), or create a site pointing to the folder (2 k and other systems ).

When you enter http: // localhost/, the content displayed is not the default IIS homepage, but the default homepage document in the Adobe Dreamweaver CS3 site folder you set.

After setting the IIS Site

1. The database file cnbruce. mdb is located in the database folder (accessible through http)

2. Adobe Dreamweaver CS3 automatically generates the Connection database file conn. asp, And the Connections folder.

3. If the connection path is successfully tested in Adobe Dreamweaver CS3, enter the address Server. Mappath ("/database/cnbruce. mdb ")

/Database/cnbruce. mdb this method is relative to the root directory, the database path is obtained in the advanced architecture, no matter which level, the site documentation under which directory can be normally displayed.

But still not recommended! The reason is as follows:

You can modify the IIS Site locally. When it is uploaded to the server or virtual host, the problem arises.

1. If your web hosting service provider is not technically close, when parsing the root directory of your website, it does not point to your site folder, but to the wwwroot folder under the server system disk. The path is definitely incorrect.

2. If you do not need to upload the root directory of your site, it is clear that the path will certainly have a parsing error.

Third: database files in the absolute local physical path

It's easy. You will always know where the database is located locally. When you create an absolute physical path in Adobe Dreamweaver CS3, you can directly use the absolute physical path address.

OK. Of course, it is not so clever: the physical path address of the database uploaded to the server is the same as the physical path address of the local database -__-!

Therefore, you only need to obtain the database files uploaded to the server space and the physical address on the server.

How to get it?

1. Create a path. asp file with simple content

2. The file and the database file cnbruce. mdb are in a folder and bundled together for upload.

3. Check path. asp in the URL address bar to obtain the physical address of cnbruce. mdb on the server and copy the path.

4. Replace the physical path in the local conn. asp file and upload it again. Everything is OK!

Features:

1. Although the platform migration is not strong, it fully supports file connections across all sites, that is, the migration between the local and server.

2. Prevent the % 5c brute-force database from indirectly obtaining the database address.

3. We recommend that you store database files in a non-Web Access Directory in more and more spaces (of course, the specific path is another method ), this requires the user to use the physical path.

Conclusion: It is best to use the database connection of the third absolute local physical path.

Author: Unknown
Related Article

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.