Connecting to a Database Using a Connection String

TimesTen applications require a DSN or a connection string be specified to connect to a database.

For modularity and maintainability, it is better to set attributes in a DSN rather than in a connection string within the application, unless a particular connection requires that specific attribute settings override the settings in the DSN or the default settings.

The syntax for a connection string contains connection attribute definitions, where each attribute is separated by a semicolon.

These precedence rules are used to determine the settings of DSN attributes:

  1. Attribute settings specified in a connection string have the highest precedence. If an attribute appears more than once in a connection string, the first specification is used.

  2. If an attribute is not specified in the connection string, the attribute settings that are specified in the DSN are used.

  3. Default attribute settings have the lowest precedence.

For details how to use a connection string instead of a DSN, see Using a Connection String in TimesTen.