DataSource

Description

Identifies the data source to which you want to connect. The data source can be a file, a database, or an ODBC data source depending on the OLE DB data provider you are using.

When to specify DataSource

You must specify the DataSource parameter before connecting to the database.

Applies to

ADO.NET

OLE DB

Syntax

DataSource='datasource_name'

Default value

None

Usage

For the SNC interface for SQL Server 2005, specifying a value for Server on the Connection page or specifying a value for SQLCA.ServerName in code is equivalent to setting this parameter.

The value of the Data Source parameter varies depending on the type of data source connection you are making. For example, if you are using Microsoft's OLE DB Provider for ODBC, you would enter the actual ODBC data source name for the Data Source value. If you are using Microsoft's OLE DB Provider for SQL Server, you would enter the actual Microsoft SQL Server server name for the Data Source value.

For more information, see the documentation provided by your OLE DB data provider.

Examples

Example 1

To use the Microsoft OLE DB Provider for ODBC to connect to the PB Demo DB:

  • Database profile

    Enter PB Demo DB in the Data Source box on the Connection page in the Database Profile Setup dialog box.

  • Application

    Type the following in code:

    SQLCA.DBParm="DataSource='PB Demo DB'"

Example 2

To use the Microsoft OLE DB Provider for Oracle to connect to an Oracle 8 database:

  • Database profile

    Enter the Oracle 8 server name in the Data Source box on the Connection page in the Database Profile Setup dialog box.

  • Application

    Type the following in code:

    SQLCA.DBParm="DataSource='Or8server'"

See also

DataLink

Provider