DSN-Less Connection Strings
DSN –less uses a custom connection String to create a connection. It is easy to maintain and transfer between two computers.
Creating DSN-Less Connection
- Place any ASP file in the root of your Customer site.
- Open the Database panel in the Application panel group or press Ctrl+Shift+F10 in Dreamweaver as shown in Figure-7.7.

Figure-7.7
- Click document type to bring up the Choose Document type dialog box as shown in Figure-7.8, if there is no check mark. Click Ok to perform Next step.

Figure-7.8
- If there is no check mark before item3, click Testing server to bring up the Site Definition dialog box. Furnish the required information and click Ok.
- If everything goes well, you are ready to create the connection. Otherwise copy the company.mdb from the code download to the database folder at C:\Inetpub\wwwroot\company\Database. On the file panel, switch to Remote view and locate your database in the Database folder. Right click the file and choose Get.
- With the ASP page open, click the plus button on the Database panel as shown in Figure-7.9.

Figure-7.9
- Select Custom Connection String option. With this Custom Connection String dialog box appear on the screen as shown in Figure-7.10.

Figure-7.10
- Type connCompanyin the Connection Name field and type the code in connection string field.
"provider = Microsoft.Jet.OLEDB.4.0; Data Source=c:\ Inetpub\wwwroot\CompanySite\Database\Company.mdb; UserId=admin; password="
- Click Test button in Custom Connection Box. If everything goes fine, your connection will be established successfully.
Connecting to a Database on an ISP
Usualy while working with commercial ISPs, one often does not know the exact physical location of the files that have been uploaded to the server. In case you don’t have a DSN available from the ISP, then one can use another way to create a connection to the database files. DSN-less connection can be used here but that can only be done if you know the exact physical path of the database file on the server.
Physical and Virtual Path
After upoading the files to the remote server using the Dreamweaver, the fils are located in the folder in the web server’s local directory. On a server using Internet Information Server, the path of the home page can be
C:\inetpub\wwwroot\hosting\useraccounts\acclaimedfishiries\index.asp
This path is the exact physical path of the file.
The URLs to the files do not use the physical paths, rather they use the domain name or the server name postfixed by a virtual path e.g.,
www.acclaimedfishiries/index.asp
Finding the Physical Path
ISPs provides you with an FTP host. A host directory, along with a login name and password.
ISPs also provide a URL to view the pages on the Internet, like www.acclaimedfishiries.com/index.asp.
Using the URL, you can find the file’s virtual path which is the one that follows the domain name. This virtual path can be used to find the file’s physical path on the web server with the help of the MapPath method in ASP.
Server.MapPath("/virtualpath")
Suppose a file’s virtual path is /database/fishiries.mdb, then the following expression will return its physical path:
Server.MapPath("/database/fishiries.mdb")
Connecting to a Database using Virtual Path
Now using the MapPath method we can get the physical path and create a DSN-less connection string for an MS Access Database
- Upload the database file to the remote server and note its virtual path e.g., /acclaimedfishiries/data/fishiries.mdb.
- Open a new ASP page in the Dreamweaver. Open the Databases panel (Window > Databases). Here you can see all the connections defined for the site
- Click the Plus (+) button on the panel and select Custom Connection String from the pop-up menu.
- Enter an arbitrary name for the new connection.
- Write the connection string and use the MapPath method to provide the value for the DBQ parameter.
If virtual path to your Microsoft Access database is /acclaimedfishiries/data/fishiries.mdb. The connection string can be expressed as follows.
"Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath¬ ("/acclaimedfishiries/data/fishiries.mdb ") Select the Using Driver On Testing Server option.
- Select the Using Driver On Testing Server option.
- Click Test.
- Click OK.
The new connection appears in the Databases panel.
Displaying Data from Database
When there is a large amount of information that is required to be displayed dynamically on the websites, the use of database comes into the scene.
Dreamweaver has several tools and readymade behaviors to help you retrieve and display information from a database.
Server Behaviors and Formatting Elements
Server behaviors and formatting elements are used to enhance the display of the dynamic data. Formats are used to apply numerical , monetary, date/time values to the dynamic text.
Repeated Region server behaviors are used to display multiple items from a databae, and specify the numbers of records to be displayed per page.
Recordset Navigation server behaviors are used to put navigation elements that lets the users move to previous or next set of the records.
Recordset Statuas Bar server behaviors are used to incldue a counter to show users within a set of records relative to the total number of records.
Show Region server behaviors are used to show or hide items on the page on the basis of the relevance of the displayed records. E.g.,. if the user is viewing the last set of records then the “next” link can be hidden and only the “previous” link can be displayed.
Applying Typograpic and Page Layout Elements to Dynamic Data
Dreamweaver can present dynamic data within a structured page by applying typographic formatting using HTML and CSS. For applying formats to dynamic data, format the tables and placeholds for the dynamic data using the formatting tools. When data is inserted from the data source, it automatically appears in the given fornt, paragraph and the table formatting as specified.
Navigating Database Recordset Results
Recordset navigation links are used for moving from one record to the other, or from one set of records to the other. If a page displays five records at a time, then you might want to have links like “Next” or “Previous” that will let the user move through the pages of records.
There are four different navigational links to move through a recordset. i.e., First, Previous, Next and Last. These links can appear in redundancy on the same page provided that they work on a single recordset.