1 Quick Start : Defining Basic Connection Strings

Defining Basic Connection Strings
Each data provider uses a connection string to provide information needed to connect to a specific database. The connection information is defined by connection string options.
The connection string options have the form:
option=value
Each connection string option-value pair is separated by a semicolon. For example:
Host=Accounting;Port=446;User ID=John;Password=T0uchd0wn
The following sections describe the minimum connection string values needed to a database:
See the connection string option chapter for the data provider for detailed information about all of the supported options.
NOTES:
Connecting to DB2
Table 1-1 lists the name and description for each connection string option required for a minimum connection to a DB2 server using an ADO.NET data provider or an Entity Framework data provider. See “DB2 Data Provider Connection String Options” for a description of all DB2 connection string options.
The following examples provide the minimum required options for a connection string for a user with the BINDADD permissions.
"Host=Accounting1;Port=50000;User ID=gene;Password=b0gey;Database=Accounting"
"Host=2001:DB8:0000:0000:8:800:200C:417A;Port=446;User ID=roger;Password=newm4n;Database=NCANSV5;Collection=ADOVS1"
"Host=10.30.14.109;Port=448;User ID=fred;Password=sailb0at;Database=S390LOC_7U"
 
Specifies either the name or the IP address of the server to which you want to connect. For example, if your network supports named servers, you can specify a server name such as DB2server. Or, you can specify an IP address such as 199.226.224.34. Note that both IPv4 and IPv6 formats can be used to identify the host. See “Using IP Addresses” for details on using IP addresses.
To connect to a DB2 server running on the local machine, specify localhost as the Host connection string option.
Adding the Provider Schema Attribute
Provider is an attribute of the Schema element in the storage model file of an Entity Data Model (EDM). The storage model file is written in the store schema definition language (SSDL).
The Entity Data Model wizard assigns the value when you select the DB2 Entity Framework data provider. If you manually define an EDM, assign the string DDTek.DB2 to the Provider attribute of the Schema element, as shown in the following code fragment:
<Schema Namespace="AdventureWorksModel.Store" Alias="Self" Provider="DDTek.DB2" ProviderManifestToken="DB2iSeries" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2006/04/edm/ssdl">
Connecting to Oracle
Table 1-2 gives the name and description for each connection string option required for a minimum connection to an Oracle server using an ADO.NET data provider or an Entity Framework data provider. The defaults listed are initial defaults that apply when no value is specified in the connection string. See “Oracle Data Provider Connection String Options” for a description of all of the connection string options.
The minimum required options for the connection string are shown in the following example:
"Host=Accounting1;Service Name=sales.us.acme.com;User ID=scott;Password=Tiger"
NOTE: In most cases, the Oracle port number is the initial default, 1521. If you are using a different port, you must add the Port connection string option. See “Port” for more information.
 
Connecting Using the Oracle tnsnames.ora File
The DataDirect Connect for ADO.NET Oracle data provider does not require the Oracle client. However, some users already have the client installed on their machines and have a tnsnames.ora file configured.
If your machine has the tnsnames.ora file configured, you can use a connection string with the following minimum connection string options:
"Data Source=datasource;User ID=userid;Password=password;"
Table 1-3 gives the name and description for each connection string option required for a minimum connection to an Oracle server for a machine that has a tnsnames.ora file. The defaults listed are initial defaults that apply when no value is specified in the connection string. See “Oracle Data Provider Connection String Options” for a description of all of the Oracle data provider’s connection string options.
 
Adding the Provider Schema Attribute
Provider is an attribute of the Schema element in the storage model file of an Entity Data Model (EDM). The storage model file is written in the store schema definition language (SSDL).
The Entity Data Model wizard assigns the value when you select the Oracle data provider. If you manually define an EDM, assign the string DDTek.Oracle to the Provider attribute of the Schema element, as shown in the following example:
<Schema Namespace="AdventureWorksModel.Store" Alias="Self" Provider="DDTek.Oracle" ProviderManifestToken="10g" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2006/04/edm/ssdl">
Connecting to Microsoft SQL Server
Table 1-4 gives the name and description for each connection string option required for a minimum connection. See “SQL Server Data Provider Connection String Options” for a description of all of the connection string options.
NOTE: In most cases, the Microsoft SQL Server port number is the default, 1433. If you are using a different port, you must add the Port connection string option. See “Port” for more information.
The following connection string contains the minimum information necessary to connect to a Microsoft SQL Server server:
"Host=Accounting1;User ID=mike;Password=b0gey;Database=Accounting"
 
Connecting to Sybase
Table 1-5 gives the name and description for each connection string option required for a minimum connection to a Sybase server using an ADO.NET data provider or an Entity Framework data provider. See “Sybase Data Provider Connection String Options” for a description of all of the connection string options.
The following connection string contains the minimum information necessary to connect to a Sybase server using an ADO.NET data provider or an Entity Framework data provider:
"Host=Accounting1;Port=4100;User ID=jimb;Password=r0ger;Database=Accounting"
 
Specifies either the name or the IP address of the server to which you want to connect. If your network supports named servers, you can specify a server name such as Sybaseserver. Or, you can specify an IP address such as 199.226.224.34 or 2001:DB8:0:0:8:800:123.456.78.90. See “Using IP Addresses” for details on using IP addresses.
Connecting Using the Sybase Interfaces File (SQL.INI)
The DataDirect Connect for ADO.NET Sybase data provider does not require the Sybase client. However, some users already have the client installed on their machines and have an interfaces file configured.
If your machine has the Sybase interfaces file configured, you can use a connection string with the following minimum connection string options:
"User ID=lucy;Password=quest;Server Name=Accounting"
Table 1-6 gives the name and description for each connection string option required for a minimum connection to a Sybase server for a machine that has an interfaces file. See “Sybase Data Provider Connection String Options” for a description of all of the connection string options.
 
Adding the Provider Schema Attribute
Provider is an attribute of the Schema element in the storage model file of an Entity Data Model (EDM). The storage model file is written in the store schema definition language (SSDL).
The Entity Data Model wizard assigns the value when you select the Sybase Entity Framework data provider. If you manually define an EDM, assign the string DDTek.Sybase to the Provider attribute of the Schema element, as shown in the following code fragment:
<Schema Namespace="AdventureWorksModel.Store" Alias="Self" Provider="DDTek.Sybase" ProviderManifestToken="15" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2006/04/edm/ssdl">