Dreamweaver

About connection strings

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
The name of a SQL Server database.

DBQ
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
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.

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