[DB-SIG] URI syntax for database

Dittmar, Daniel daniel.dittmar at sap.com
Mon Apr 4 14:23:02 CEST 2005


>pydbapi-mx.ODBC.Windows://<uid>:<pwd>@sqlserver.example.com/?DA
>TABASE=test
>
>Looking at this URI I don't think that the URI-approach is
>going to make things any easier for the user in setting up
>things.

If I understood Ian right, he doesn't wants to improve on
import dbmodule
session = dbmodule.connect ()

He rather wants to have the possibility to store all the information for
a connection in configuration files. Ideally, the controlling program
shouldn't need any database driver specific code to create a connection
object. 

The alternative was to call the connect method through keyword args. The
controlling program could read the properties out of .ini file, out of
XML files, parse a URI or whatever. The problem with that approach was
that for some parameters, a string value wouldn't be accepted. So the
controlling program would need a way to know which parameters require
type conversion. The solution to this one could be that the DB API
mandates that connect functions accept strings for all arguments. And
until this is implemented, the controlling program has to implement this
mapping for each database driver itself.

The approach through keyword arguments could have the advantage that it
is easier to add some property values at runtime, for example, if the
password must be entered interactively. Inserting it into a URI would
require some knowledge about the URI format (which is supposed to be
database specific).

Daniel Dittmar

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


More information about the DB-SIG mailing list