Re: DBIx::DBH - Perl extension for simplifying database connectio ns

From: Tim Bunce (Tim.Bunce_at_pobox.com)
Date: 12/08/04


Date: Wed, 8 Dec 2004 11:30:06 +0000
To: Jonathan Leffler <jonathan.leffler@gmail.com>

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
> > dbase@server1 # 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
        database=dbase@server1
        database=@server1
        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.



Relevant Pages

  • Forward port of latest RT patch (2.6.21.5-rt20) to 2.6.22 available
    ... I just wanted to let you guys know that our team has a port of the ... # ACPI (Advanced Configuration and Power Interface) Support ... # AX.25 network device drivers ...
    (Linux-Kernel)
  • long-term regression
    ... I haven't had time to bisect this, but I'm having a problem on a AMD64 gentoo system where the printer doesn't work with recent kernels. ... dmesg appears to show the port being detected, but writes to the port under newer kernels appear to complete, but no data gets to the printer. ... # ACPI Support ... # Device Drivers ...
    (Linux-Kernel)
  • Re: v2.6.22.1-rt1 (-rt2)
    ... This release is a port of -rt to the latest upstream kernel. ... # Loadable module support ... # RAM/ROM/Flash chip drivers ...
    (Linux-Kernel)
  • Re: 2.6.21-rc2 regression vs. 2.6.20: AT keyboard only works with pci=noacpi
    ... the problem is that my ps/2 port keyboard is completely frozen ... on boot - usually it gets activated when udev probes for hardware (my kernel ... # ACPI Support ... # Infrared-port device drivers ...
    (Linux-Kernel)
  • Network performance degradation from 2.6.11.12 to 2.6.16.20
    ... I have a system with a strange network performance degradation from ... This system requests weather data from a variety of systems using RPC calls over a reserved TCP port, puts them into a memory mapped queue file, and then sends the data out to a variety of downstream requesting systems, again using RPC calls. ... # Firmware Drivers ... # ACPI Support ...
    (Linux-Kernel)