On Tue, Dec 07, 2004 at 10:26:22PM -0800, Jonathan Leffler wrote:
> > 
> > I just looked at the DBD::Informix docs. According to them Informix takes a
> > connections string like:
> > "dbi:Informix:$database" where $database is constructed like this:
> > 
> >     dbase               # 'Local' database
> >     //machine1/dbase    # Database on remote machine
> >     [EMAIL PROTECTED]       # Database on (remote) server (as defined in 
> > sqlhosts)
> >     @server1            # Connection to (remote) server but no database
> >     /some/where/dbase   # Connect to local SE database
> 
> Only one of the Informix notations has a host name in it [...]
> None of the notations goes anywhere near a port [...]
> The server names referenced are entries in the sqlhosts file.

> What should DBD::Informix do if it is commanded to connect to a
> machine name and a port number?

It should generate an error.

Here's an updated version if the doc patch I posted earlier. Note the
last four lines:

: It is recommended that drivers support the ODBC style, shown in the
: last example above. It is also recommended that that they support the
: three common names 'C<host>', 'C<port>', and 'C<database>' (plus 'C<db>'
: as an alias for C<database>). This simplifies automatic construction
: of basic DSNs: C<"dbi:$driver:database=$db;host=$host;port=$port">.
: Drivers should aim to 'do something reasonable' when given a DSN
: in this form, but if any part is meaningless for that driver (such
: as 'port' for Informix) it should generate an error if that part
: is not empty.

The key point here is that if a user is presented with a dialog box
with four fields [Driver, Database, Host, Port] they ought to be able
to enter values that make sense to them and get themselves connected.

For DBD::Informix the simplest thing to do is allow any of the five
forms above to be specified in the 'database' part and require the
'host' and 'port' parts, if present, to be empty. One step beyond that
would be to use the 'host' part for the //machine1/... form:

        database=dbase
        database=dbase;host=machine1
        [EMAIL PROTECTED]
        [EMAIL PROTECTED]
        database=/some/where/dbase

Alternately feel free to ignore the whole issue, as supporting this
form of DSN is not mandated, just recommended.

> Fundamentally, the DBI spec says: you connect to a database X by
> specifying 'dbi:X:whatever-X-chooses'.  Trying to specify
> 'whatever-X-chooses' in some way that is independent of X is nonsense
> - and that's why the DBI spec does things the way it chooses to.

Yeap. But, as always, I'm trying to find the sweet-spot.

> Deep breath.  Calm, gentle typing...  Relax.

:)

I have painted this bikeshed, and now we all get to live with it.

I think this topic is closed.

Tim.

Reply via email to