21 The Salesforce Driver : Database Configuration File

Database Configuration File
You can configure an embedded database and data mapping using a database configuration file in XML format. Some of these values you can set in the file are the same as those you can set using the Config Options connection option (see “Connection Option Descriptions”). Some database configuration values can be set only using a configuration file.
The name of the database configuration file has the format:
databasename.config
where databasename is the name of the database to be configured. For example, if your environment has a database named mydb or a database configuration file named mydb.config, when the driver establishes a connection, it performs the following tasks:
Checks to see if an embedded database named mydb exists (or a database using the default databasename if one is not specified). If mydb exists, the driver connects to the remote data source using the mydb database.
If mydb does not exist and the driver is configured to create a database, the driver looks for a database configuration file named mydb.config. If the database configuration file exists, the driver creates the database and mapping using the properties specified in the database configuration file.
If mydb.config does not exist, the driver generates a database configuration file with default settings and uses those settings to create the database and its mapping.
The following is an example database configuration file:
<?xml version='1.0' encoding='UTF-8'?>
<Database xmlns="http//datadirect.com/cloud/config/1.0">
  <User name="CONNECT2" defaultSchema="SFORCE">
    <UseSchema name="SFORCE"/>
    <UseSchema name="PUBLIC"/>
  </User>
  <Schema name="SFORCE" type="Salesforce">
    <ConfigOptions>uppercaseidentifiers=true;localtables=0;auditcolumns=none;
     customsuffix=strip;=</ConfigOptions>
<SessionOptions>loginhost=test.salesforce.com;userid=
     connect2@progress.com</SessionOptions>
  </Schema>
  <Schema name="PUBLIC" type="local">
  </Schema>
</Database>
The following are descriptions of the elements of the database configuration file.
Database
Child Elements
User, Schema
Description
The Database element is the root element of the database configuration file. It does not define any configuration; it contains all of the elements that do define the database configuration. One and only one Database element must exist.
User
Parent Element
Database
Child Element
UseSchema
Description
Specifies the User ID used by the driver. At least one User element must exist.
Attributes
name [required]: The user name is a string with a maximum length of 128 characters. The default is name=userid, where userid is the User ID used by the driver.
defaultSchema: The name of the schema to use for unqualified table and column identifiers. If defaultSchema is not specified, the schema specified in the first useSchema child element is used as the default schema. The default is defaultSchema=SFORCE.
UseSchema
Parent Element
User
Child Element
None
Description
The UseSchema element specifies a schema that is visible to the user of this element. A schema contains the mapping between the remote data model and the relational tables the driver exposes. Multiple schemas can be associated with a user. At least one UseSchema element must exist.
A basic User definition typically has two UseSchema elements: one that specifies the mapping to the remote data source and one for the local schema.
Attributes
name [required]: The name of the schema to associate with the user. The schema name is a string with a maximum length of 128 characters. The defaults are name=SFORCE [remote] and name=PUBLIC [local].
Schema
Parent Element
Database
Child Elements
ConfigOptions, SessionOptions
Description
The Schema element defines the schema that contains the mapping for a remote data source. The database configuration file must contain at least one schema definition and may contain multiple schema definitions. Each schema definition defines the type of the data source to which the schema maps, the information to connect to the remote database (except password), and the information needed to configure the remote data model to relational table mapping. At least one Schema element must exist.
Attributes
name [required]: The name of the schema that defines the data model to relational mapping. This attribute can be any valid identifier name. The defaults are name=SFORCE for the remote data source and name=PUBLIC for the local database.
type [required]: The type of remote data source for which the schema defines mapping. This attribute must be type=Salesforce for the remote data source and type=local for the local database.
ConfigOptions
Parent Element
Schema
Child Element
None
Description
The ConfigOptions element is a string that specifies the configuration options used to define how the remote data source data model is mapped to relational tables. The ConfigOption string has the same keys, values, and syntax as the Config Options connection option (see “Connection Option Descriptions”) except that the enclosing parentheses are not required (see example configuration file). The default is an empty string.
Attributes
None
SessionOptions
Parent Element
Schema
Child Element
None
Description
The SessionOptions element is a string of key value pairs that specifies the information needed to connect to the remote data source. SessionOptions includes the server name and remote user id, for example:
loginhost=login.salesforce.com;userid=john.public@abccorp.com
Attributes
None