scanning

DSNs Parsing "mysql://joe@big.disk.net/pictures.db"-Strings

The latest version of this document can be found here.

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. Functions can be used to collect the pieces of the DSN string from the parse result. The parser recovers from a few errors in DSNs. It can report these errors by calling a procedure supplied by the user. This allows writing parser messages to log files, for example.

The library is distributed as a source code archive. The archive contains documentation in in source form. A PDF version of the documentation is online.

Examples

db2://joe@big.disk.net/pictures
A DB/2 database server is running on host big.disk.net. The name of the database to use is pictures. Connect to the database system as user joe.
oci://joe:1"!4-@tcp+big.disk.net:1502
An Oracle database server is running on host big.disk.net. It is listening on port 1502, tcp is the protocol to use. Use a default database. Connect to the database system as user joe and supply the string 1"!4- as password.
sqlite:///c:\data\base.db?mode=0666&persistent=true
Connection to SQLite. The database is c:\data\base.db. Additional parameter values for mode and persistent are specified using CGI query string syntax.

Grammar

DSN DB Traditional
DSN DBSpeak Variant
DB“access” | “dbase” | “db2” | “ifx” | “msql” | “mssql”
DB“mysql” | “navision”
DB“oci” | “pgsql” | “solid” | “sqlite” | “sybase”
Traditional
Traditional ‘:’ ‘/’ ‘/’ DBTail
Traditional ‘:’ ‘/’ ‘/’ Login QS
Traditional ‘:’ ‘/’ ‘/’ Login DBTail
Login Server
Login User ‘@’ Server
User NAME
User NAME ‘:’ PASSWORD
Server Protocol ‘+’ HostPort
Server HostPort
HostPort Host
HostPort Host ‘:’ Port
Host IP | HOSTNAME
DBTail ‘/’ Database QS
Database NOTQMARKS
Port DECIMAL_DIGITS
QS ‘?’ PARAMETERS
QS
DBSpeak“odbc” ‘(’ DB ‘)’
Variant
Variant ‘:’ ‘/’ ‘/’“......TODO......”
If you have any questions, please write to Georg Bauhaus