A connection string is a set of connection parameters that is passed from an application to the UltraLite runtime so that a database connection can be defined and established. Some parameters are always required to open a connection while others are used to adjust database features for a single connection.
Connection strings are defined as keyword=value pairs in a semicolon delimited list. The following example illustrates a connection string fragment that specifies a database file name, user ID, and password:
DBF=myULdb.udb;UID=JDoe;PWD=token
Methods of supplying these parameters to a database can vary depending on whether you are connecting from an UltraLite utility or an UltraLite application.
UltraLite command line utilities typically use a connection string if a connection to a database is required.
UltraLite applications can be developed using an UltraLite API to read connection parameter values from a stored file or in the application code. You can supply fixed connection strings when user authentication is not required, or prompt users to supply parameter values at connection time.
When a connection string has been assembled, it is passed to the UltraLite runtime for processing. The connection to the database is granted when the connection attempt is validated. Connection failures can occur if the database file does not exist, or the authentication was not successful.
UltraLite generates an error when it encounters an unrecognized connection parameter.
You can use a prefix with a connection parameter to specify that a parameter applies only when an application is running on a particular output. For UltraLite, these prefixes are desktop: and device:.
Any leading and/or trailing spaces in connection string parameter values are ignored. Connection parameter values cannot include leading single quotes ('), leading double quotes ("), or semicolons (;).
For example, if you use the ulload utility, the following connection string is used to load new XML data into an existing database. You cannot connect to the database file until you supply this string:
ulload -c "DBF=sample.udb;UID=DBA;PWD=sql" sample.xml