Setting the Connection String option

Setting the Connection String option

A connection string combines all the information your web application needs to connect to a database. Dreamweaver inserts this string in your page’s server-side scripts for later processing by your application server.

A connection string for Microsoft Access and SQL Server databases consists of a combination of the following parameters separated by semicolons:

Provider specifies the OLE DB provider for your database. For example, here are parameters for common OLE DB providers for Access, SQL Server, and Oracle databases, respectively:

Provider=Microsoft.Jet.OLEDB.4.0;...
Provider=SQLOLEDB;...
Provider=OraOLEDB;...

For the parameter value of your OLE DB provider, see your provider vendor’s documentation, or consult your system administrator.

If you don’t include a Provider parameter, then the default OLE DB provider for ODBC is used and you must specify an appropriate ODBC driver for your database.

Driver specifies the ODBC driver to use if you don’t specify an OLE DB provider for your database.

Server specifies the server hosting the SQL Server database if your web application runs on a different server.

Database is the name of a SQL Server database.

DBQ is the path to a file-based database such as one created in Microsoft Access. The path is the one on the server hosting the database file.

UID specifies the user name.

PWD specifies the user password.

DSN is the data source name, if you use one. Depending on how you define the DSN on your server, you can omit the connection string’s other parameters. For example, DSN=Results can be a valid connection string if you define the other parameters when you create the DSN (see Using a DSN).

Connection strings for other kinds of databases may not use the parameters listed above, or will have different names or uses for the parameters. For more information, see your database vendor’s documentation, or consult your system administrator.

Here’s an example of a connection string that will create an ODBC connection to an Access database called trees.mdb:

Driver={Microsoft Access Driver (*.mdb)};
DBQ=C:\Inetpub\wwwroot\Research\trees.mdb

Here’s an example of a connection string that will create an OLE DB connection to a SQL Server database called Mothra located on a server called Gojira:

Provider=SQLOLEDB;Server=Gojira;Database=Mothra;UID=jsmith;
PWD=orlando8

Related topics

  • Creating a DSN-less connection
  • OLE DB connections
  • Using a virtual path to connect to a database


Getting Started with Dreamweaver
Dreamweaver Basics
Working with Dreamweaver Sites
Laying Out Pages
Adding Content to Pages
Working with Page Code
Preparing to Build Dynamic Sites
Making Pages Dynamic
Developing Applications Rapidly
 
ASPTreeView.com
 
Evaluation has Ш¶ДЅexpired.
Info...