Accessibility

TechNote

Understanding design-time and run-time connections in Dreamweaver

What are design-time and run-time connections?
There are two possible types of database connections involved when creating and testing dynamic database-driven web pages in Macromedia Dreamweaver MX: (1) the design-time connection and (2) the run-time connection. You use the design-time connection when working inside of Dreamweaver MX creating recordsets and applying server behaviors. You use the run-time connection when testing a completed dynamic page in a web browser or in the Dreamweaver MX Live Data mode.

Having separate design-time and run-time connections can oftentimes solve database connection errors within Dreamweaver MX. Separate connections can also usually speed up development time when working in Dreamweaver MX. When using separate design-time and run-time connections, the design-time connection will use a local database driver, a local DSN, and/or a local copy of the database, installed on the same machine that Dreamweaver MX is installed on. The run-time connection will use the driver and database on the testing server, which is also most likely your production server.

When should you use a separate local design-time connection?
Separate design-time and run-time connections are not required for all users. In fact, some of the Dreamweaver MX server models and platforms do not offer users a choice of using separate connections. However, many Dreamweaver MX users will have a choice and here are some reasons that you may want to consider using separate connections:

Whenever you test your database connection in the connection dialog box, an error occurs. Therefore, you are unable to create recordsets or apply server behaviors to your pages.

While it is usually possible to troubleshoot these problems, sometimes the fastest and easiest route to resolution is to use a local design-time connection.

You need to work on your database-related pages but do not have network or FTP access to the database. For example, you have taken your laptop to the beach and want to work on your web application.
It will take some time for your server administrator to setup a DSN for you on the server, but you want to get started right away on developing your pages.

Examples of typical errors that may occur:

HTTP Error Code 404 File Not Found. Here are some possible reasons for the problem:

There is no testing server running on the server machine.

The testing server specified for this site does not map to the http://myserver/mysite/_mmServerScripts/MMHTTPDB.asp URL. Verify that the URL Prefix maps to the root of the site.

An FTP error occurred - cannot open remote folder users/tjones/.
550 /users/tjones: Access is denied.
An FTP error occurred - cannot make connection to host.
An unidentified error has occurred

Which Dreamweaver users can and cannot use a separate local design-time connection?

Platforms and server model combinations where you can use separate design-time connections:

ASP on Windows
ColdFusion (UltraDev 4 code model) on Windows and Macintosh. On the Macintosh, this option is only available if you choose "Data Source Name Advanced".
JSP on Windows and Macintosh

Platforms and server model combinations where you cannot use separate design-time connections:

ASP on Macintosh
ASP.NET on Windows and Macintosh
ColdFusion (Dreamweaver MX code model) on Windows and Macintosh
PHP on Windows and Macintosh

How to use a local design-time connection
The database connection dialog box in Dreamweaver looks different depending on the server model, platform, and driver type, but in general, you want to select the radio button option that says something like "Using Driver On This Machine" or "Using Local DSN". You do not want to select the radio button option that says "Using Driver On Testing Server" or "Using DSN on Testing Server". Here are some examples:

ASP - Data Source Name (DSN) - Windows:

ASP - Custom Connection String - Windows:

ColdFusion (UltraDev 4 code model) on Windows:

JSP - Data Source Name (DSN) - Windows and Macintosh:

If you are using a DSN, make sure that the name of the DSN on your local machine exactly matches the name of the DSN on the server.

If you are working on an ASP site using a connection string to an Access database there are a few different ways to proceed:

Find out what the physical path is to the Access .mdb file located on the server. Then replicate that directory structure on your local machine that Dreamweaver is installed on.

For example, if your .mdb file is located on the server in the following folder: C:\customers\utah\tjones\databases\, then create the same directory structure on your local hard drive, and place a copy of the database in that folder.

If you don't want to (or can't) replicate the server directory structure on your local machine as mentioned above, there is another option. You could design your ASP pages in Dreamweaver, and once you are done working on the page, edit the connection file so that it uses the physical path to the .mdb file on the server.

Once the path in the connection file is changed, you will no longer be able to edit the server behaviors with Dreamweaver's visual tools, unless you change the connection string back to what was used when designing the pages (the physical path to your local copy of the database).

You can use the Server.MapPath method. See the TechNote mentioned below in Additional information.

Using local design-time connections to troubleshoot database connection errors
When you specify "Using Driver On Testing Server" or "Using DSN on Testing Server" in the connections dialog box, Dreamweaver automatically uploads an MMHTTPDB script file to the testing server in order to manipulate the remote database driver via the HTTP protocol. You will notice the MMHTTPDB script files inside the _mmServerScripts folder, located in the root of your website. While HTTP remote database connectivity works fine for most users, several types of FTP or network problems can occur:

Incorrect permissions to upload files or folders to the testing server
An incorrect folder or URL prefix has been specified in the Dreamweaver site definition
There maybe a problem with the username and password being used
The FTP service may not be running on the testing server, or the testing server maybe down

Note:Dreamweaver's Site window hides the _mmServerScripts folder. You can see the _mmServerScripts folder if you use Windows Explorer, Finder on the Macintosh, or a third-party FTP client.

When you specify "Using Driver On This Machine" or "Using Local DSN" the driver is on the same machine as Dreamweaver, so no network communication is necessary to get to the database driver. As a result, FTP and network problems are eliminated and Dreamweaver can access the database quicker and easier. The testing server does not even need to be running, unless that server also houses the database.

If I specify a local driver or DSN for my connection in Dreamweaver, will visitors to my website use the database on my local machine or on the server?
Some users may be concerned that if they specify "Using Driver On This Machine" or "Using Local DSN," which connects to a local copy of the database, website viewers will be connecting to this local copy of the database. This will not be the case. Dreamweaver itself will connect to your local database to make recordsets and server behaviors, however, your website visitors will be connecting to the database on the server.

This is because they will be viewing the web pages from the server: http://www.myserver.com/mypage.asp. Since they are requesting to see the page from "myserver.com," they will be using the DSN or driver located on "myserver.com." The only way visitors could theoretically use the local copy of the database would be if you gave them your workstation's IP address, or if they logged onto your machine in person and typed http://localhost/mypage.asp, neither of which would occur under most circumstances.

Why can't I use a local DSN or local driver in ASP on a Macintosh?
The Macintosh does not have native ODBC drivers or OLE DB providers, both of which are technologies specific to Windows. Therefore, Macintosh users cannot use a local DSN, local ODBC driver or local OLE DB provider. "Using Driver On Testing Server" or "Using DSN on Testing Server" are the only options for Macintosh users with sites using the ASP server model.

Using local versions of application servers to troubleshoot database connection errors
As mentioned above, certain server models do not offer the choice to use a local driver: ASP.NET, PHP and ColdFusion (Dreamweaver MX code model). They always use the driver on the testing server, however, you can turn your local machine into a testing server.

All of the server models supported by Dreamweaver MX have servers that can be installed locally on the same machine on which Dreamweaver is installed.

Note:Macintosh users should read Using Dreamweaver with server-side technologies on a Macintosh (TechNote 16487).

Windows 2000 Pro and XP Pro come with IIS, so you can run ASP and ASP.NET pages on your local workstation.
There are single-user, developer editions of ColdFusion and JRun available that can be installed on Windows workstations.
PHP and Tomcat can be installed on a Windows workstation.

If you are having trouble connecting to a database within Dreamweaver, you may want to install local versions of the application server. This would allow you to set the testing server to point to your own machine, eliminating any possible FTP or network problems.

You could then create pages without worrying about connecting to another machine. For example, you could now go to the beach with your laptop, create your dynamic pages, and even test them in a browser using your local application server. Once finished with the pages, you could then upload them to your production server.

Additional information
For troubleshooting tips relating to database connections, please refer to: 404 Error defining database connections using FTP in UltraDev (TechNote 15711).

For more details on Macintosh configurations, please refer to Using Dreamweaver with server-side technologies on a Macintosh (TechNote 16487).

For tips on FTP, please refer to Troubleshooting FTP issues (TechNote 14834).

For information on using local web servers, please refer to Using IIS or PWS locally on Windows (TechNote 16488).

For information on using Server.MapPath in ASP, please refer to Using Server.MapPath in database connection strings (TechNote 14967).

For tips on setting up Dreamweaver to test with local and remote servers, please refer to Defining a site that uses PWS/IIS locally and FTP remotely (TechNote 15571).

For help setting up the site definition in Dreamweaver, please refer toLive Data Preview - tips and troubleshooting techniques (TechNote 14619).



AlertThis content requires Flash

To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.

Download the free Flash Player now!

Get Adobe Flash Player

Creative Commons License

Search Support


Document Details

ID:tn_16566

Products Affected:

dreamweaver