The Data Source Name parser is a simple subprogram library. The subprograms can be used to parse a DSN string which specifies how to connect to a database system. After parsing, the pieces of the data source information are available through querying functions. DSNs include for example ODBC connect strings. The idea is to connect programs to databases chosen at start-up time or at run time, using external DSN strings without any need to change the program. Examples of this kind of database connection control include configuration file settings and run-time configuration over networks.
The parser recovers from a few errors in DSNs. A programmer-supplied procedure can report these errors.
The library is distributed as a source code archive. The archive also contains the source text of the documentation. A PDF file of the documentation is available online.
Each of the following functions is called with a parse result, dsn. The parse result is what the library's parsing function produces from an input DSN. Here, the input string to the parser has been the DSN string in the first example above.
db2 ↔ database_system_name(dsn)
joe ↔ user_name(dsn)
big.disk.net ↔ host_name(dsn)
pictures ↔ database_name(dsn)
| DSN | → | DB ConSpec |
| DSN | → | AccessMethod ‘(’ DB ‘)’ ConSpec |
| DB | → | “access” | “dbase” | “db2” | “ifx” | “mimer” | “monetdb” |
| DB | → | “msql” | “mssql” | “mysql” | “navision” |
| DB | → | “oci” | “pgsql” | “solid” | “sqlite” | “sybase” |
| AccessMethod | → | “adbc” | “jdbc” | “odbc” |
| ConSpec | → | ⊥ |
| ConSpec | → | ‘:’ ‘/’ ‘/’ DBTail |
| ConSpec | → | ‘:’ ‘/’ ‘/’ Login QS |
| ConSpec | → | ‘:’ ‘/’ ‘/’ Login DBTail |
| Login | → | Server |
| Login | → | User ‘@’ Server |
| Login | → | User ‘@’ |
| User | → | NAME |
| User | → | NAME ‘:’ PASSWORD |
| Server | → | HostPort |
| Server | → | Protocol ‘+’ HostPort |
| Server | → | Protocol ‘(’ HostPort ‘)’ |
| Server | → | Protocol ‘(’ BAL_NOTQMARKS_NOTATSIGNS ‘)’ |
| HostPort | → | Host |
| HostPort | → | Host ‘:’ Port |
| Host | → | IP | HOSTNAME |
| Protocol | → | “tcp” | “unix” |
| DBTail | → | ‘/’ Database QS |
| Database | → | NOTQMARKS |
| Port | → | DECIMAL_DIGITS |
| QS | → | ‘?’ PARAMETERS |
| QS | → | ⊥ |
$Date: Sat, 18 Jun 2005 00:35:30 +0200 $