On Thu, 02 Dec 2004 08:53:38 +0100, Cosimo Streppone
<[EMAIL PROTECTED]> wrote:
> Tim Bunce wrote:
> 
> > I know what it does, I'm trying to find real examples that demonstrate
> > why people think it's needed. Nick has provided a good one. Any others?
> 
> Something like DBIx::DBH is in use in our organization.
> This is because every sql "source" (meaning database table)
> is accessed with standard objects and an external definition file
> like:
> 
>    USER john
>    PASS smith
>    DBNAME <default>
>    FILE sessions
>    HOST my.hostname.com
>    PORT 1521
> 
>    # ...
>    # Definition of table fields
>    myfield1  ... bla bla blah
>    myfield2  ... bla bla blah
> 
> Thus, every piece of information needed for connection *should*
> be separated and a frontend is provided to be able to define new
> sources or modify existing sources from a browser.
> 
> Then, we provide different sql "driver" modules, that assemble
> the DSN string given all the pieces.
> 
> For some db servers like Sybase, DB2 (MySQL?) a
> "use <dbname>" is needed after connection to properly select
> the database. Of course this is handled by the driver class.

Assuming that you're talking about IBM DB2 Universal Database, you're
doing something strange and unnatural with DB2 if you have to 'use
<dbname>'  after making a connection. If you've cataloged the DB2
database in your DB2 client, the DBD::DB2 connection string syntax is
simply:

DBI->connect("dbi:DB2:$dbname", $user, $password);

Dan

Reply via email to