An ASP application must connect to a database through an open database connectivity (ODBC) driver or an object linking and embedding database (OLE DB) provider. The driver or provider acts as an interpreter that lets the web application communicate with the database. For more information on the role of database drivers, see Communicating with the database. The following table shows some drivers you can use with Microsoft Access, Microsoft SQL Server, and Oracle databases:
Database |
Database driver |
---|---|
Microsoft Access |
Microsoft Access Driver (ODBC) Microsoft Jet Provider for Access (OLE DB) |
Microsoft SQL Server |
Microsoft SQL Server Driver (ODBC) Microsoft SQL Server Provider (OLE DB) |
Oracle |
Microsoft Oracle Driver (ODBC) Oracle Provider for OLE DB |
You can use a data source name (DSN) or a connection string to connect to the database.
A DSN is a one-word identifier, such as myConnection, that points to the database and contains all the information needed to connect to it. You define a DSN in Windows. You can use a DSN if youre connecting through an ODBC driver installed on a Windows system. For detailed instructions, see Creating a DSN connection.
A connection string is a hand-coded expression that identifies the database and lists the information needed to connect to it. The following is an example:
Driver={SQL Server};Server=Socrates;Database=AcmeMktg; UID=wiley;PWD=roadrunner
You must use a connection string if youre connecting through one of the following:
For detailed instructions, see the following sections:
NOTE |
|
You can also use a connection string if youre connecting through an ODBC driver installed on a Windows system, but using a DSN is easier. |