[DB-SIG] URI syntax for database (was: [SQLObject] Re: SQLite connection - relative filename)

Dittmar, Daniel daniel.dittmar at sap.com
Mon Apr 4 12:11:04 CEST 2005

>From: db-sig-bounces at python.org 
>[mailto:db-sig-bounces at python.org] On Behalf Of Ian Bicking
> After that it's 
>potentially entirely up to the database driver, though of course some 
>uniformity is nice.  Typical DSNs, from what I can tell, are parsed in 
>an up-front manner into a set of keys and values; though maybe they 
>sometimes include a prefix indicating database type...?  

DSNs (Data Source Names) are registry keys. The entry for that key
contains among other things the id of the ODBC driver. The string for a
connect contains the DSN (which is evaluated by the driver manager) and
additional connect properties (which are passed to the driver). This at
least was the general idea, which has probably been bended since.

> Java has 
>database URIs too, don't they?  But they are all like 
>jdbc:..., correct? 


>  Of course, following that pattern you could get 
>dbapi:jdbc:postgresql://... which feels awfully weird to me.

a) I'd prefer pydbapi: as a prefix. That way, someone looking at a
configuration file could at least get the notion that any problems might
be related to some Python lib.

b) Using a module path instead of a DBMS product name is generally
preferable (and seemed to be the consent so far). With the JDBC scheme,
all relevant drivers have to be loaded into memory first, the diver
manager then asks each if the driver would accept a specific URI. 

c) Should username and password be used similar to other protocols?

Daniel Dittmar

Daniel Dittmar
SAP Labs Berlin
daniel.dittmar at sap.com  

More information about the DB-SIG mailing list