To write a DSN-less connection string to a database file located on a remote server, you must know the physical path to the file. For example, here is a typical DSN-less connection string for a Microsoft Access database:
Driver={Microsoft Access Driver (*.mdb)}; DBQ=c:\Inetpub\wwwroot\accounts\users\jsmith\data\statistics.mdb
If you dont know the physical path of your files on the remote server, you can get the path by using the MapPath
method in your connection string.
Make a note of its virtual path--for example, /jsmith/data/statistics.mdb.
Dreamweaver displays all the connections defined for the site.
NOTE |
|
Do not use any spaces or special characters in the name. |
MapPath
method to supply the DBQ parameter.
Suppose the virtual path to your Microsoft Access database is /jsmith/data/statistics.mdb. The connection string can be expressed as follows if you use VBScript as your scripting language:
"Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath? ("/jsmith/data/statistics.mdb")
The ampersand (&) is used to concatenate (combine) two strings. The first string is enclosed in quotation marks and the second is returned by the Server.MapPath
expression. When the two strings are combined, the following string is created:
Driver={Microsoft Access Driver (*.mdb)}; DBQ=C:\Inetpub\wwwroot\accounts\users\jsmith\data\statistics.mdb
If you use JavaScript, the expression is identical except that you use a Plus (+) sign instead of an ampersand (&) to concatenate the two strings:
"Driver={Microsoft Access Driver (*.mdb)};DBQ=" + Server.MapPath? ("/jsmith/data/statistics.mdb")
Macintosh users can ignore this step because all database connections use the application server.
Dreamweaver attempts to connect to the database. If the connection fails, double-check the connection string.
If the connection still fails, contact your ISP to make sure the database driver you specified in the connection string is installed on the remote server. Also check that the ISP has the most recent version of the driver. For example, a database created in Microsoft Access 2000 will not work with Microsoft Access Driver 3.5. You need Microsoft Access Driver 4.0 or later.
The new connection appears in the Databases panel.
To update the connection of a dynamic page, open the page in Dreamweaver, double-click the recordset name in the Bindings panel or Server Behaviors panel, and select the connection you just created from the Connection pop-up menu.