Prev | What's New in Pervasive.SQL V8.5 | Next |
Database URIs
A key concept in using the Btrieve Login API or the implicit login functionality via the Create or Open functions is the database URI (Uniform Resource Indicator). It provides a syntax to describe the address of a database resource on a server.
This section describes the syntax and semantics of the URIs used in Btrieve APIs.
Syntax
The basic syntax of the URI is
access_method://user@host/dbname?parameters
Table 3-1 Elements of a Database URI Element Definition access_method The method used to access the database. Currently, onlybtrv
is supported. user An optional user name. The password for the user is specified in parameters if needed. host A server where the database is located. The local machine is assumed if host is not specified. dbname An optional database name, which corresponds to an entry in the DBNAMES.CFG file for the Pervasive.SQL V8 database engine. If no database name is specified, then the default database "DefaultDB" is assumed. parameters Additional parameters, which are delimited by the & (ampersand) character.
- table=table - allows you to specify a specific SQL table name.
- dbfile=file - Name of a file whose location is relative to the current database's data file locations entry in DBNAMES.CFG. The full file name will be resolved by the engine handling the request; the Pervasive.SQL client (MIF) will not manipulate <dbfile> in any manner. The use of drive letters is discouraged but if present will be assumed to be server side and not client side drive letters. Embedded spaces are permitted - they will be escaped by the engine. Using a UNC path is also permitted.
- file=file - allows you to specify a specific data file name. Embedded spaces are permitted in this parameter.
- pwd=password - clear text password. The Pervasive.SQL client (MIF) will change clear text passwords into encrypted passwords before transmission across the wire.
- prompt=[ yes | no ] Tells the Win32 requester how the application wants to handle the login dialog box pop-up when the MicroKernel returns status 170 (Login failed due to missing or invalid user name) or 171 (Login failed because of invalid password). If prompt=yes is specified, the requester will always display the login dialog even if the Prompt for Client Credentials setting is Off. If prompt=no is specified in the URI, the requester assumes that the application wants to receive the status 170/171 directly and does not want the requester to display the dialog. This is useful if you want your applications to handle the prompting for credentials in response to any 170 or 171 status codes. Values other than yes or no are ignored and the requester displays the login dialog based on the Prompt for Client Credentials setting. This option is ignored on Linux and NetWare machines that are acting in the role of a client.
Special Characters
As with any URI, certain non-alphanumeric characters have special significance in the URI syntax. If you wish to use one of these characters within one of the fields in the URI, you must use an escape sequence to identify the character as actual text rather than a special character. An escape sequence is simply another special character or character combination that represents the plain text equivalent of a special character. The table below shows the special characters supported by Btrieve URI syntax, and their associated escape sequences (represented by the percent sign and the hexadecimal value for the specified character). For more information on special characters in URIs, see the RFC1738 specification at http://www.faqs.org/rfcs/rfc1738.html.
Although the space character is reserved in the URI specification, it can be used without quotes and without escape sequencing because it is not used as a delimiter. The other symbols in the table above are used as delimiters and therefore must be escaped.
Examples
This section shows examples of URIs using escape sequences to identify special characters used within the field values.
Remarks
Some or all of the syntax elements user and
?
parameters may be excluded.Note that an empty user name or password is different than no user name or password. For example,
btrv://@host/
has an empty user name, whilebtrv://host/
has no user name, andbtrv://foo@host/?pwd=
has a user name of "foo" with an empty password.Examples
A URL (or "Uniform Resource Locator") is simply the address of a file or resource on the Internet. The database URI uses the same notion to address a database on a server. This section describes the syntax and semantics of URIs for Pervasive.SQL databases, particularly using the Btrieve access.
Prev Btrieve Updates Overview |
Contents Up Check for Revisions | Next New Btrieve Login Operation |