[ANN] DBIx::DBH - Perl extension for simplifying database connections

From: Terrence Brannon (bauhaus_at_metaperl.com)
Date: 03/23/05


To: dbi-users@perl.org
Date:  Wed, 23 Mar 2005 02:21:42 +0000

Version 0.07 of DBIx::DBH has entered CPAN with support for Sybase
connections provided by Rachel Richard.

NAME
     DBIx::DBH - Perl extension for simplifying database connections

ABSTRACT
    DBIx::DBH is designed to facilitate and validate the process of creating
    DBI database connections. It's chief and unique contribution to this set
    of modules on CPAN is that it forms the DSN string for you, regardless
    of database driver. Another thing about this module is that it takes a
    flat Perl hash as input, making it ideal for converting HTTP form data
    and or config file information into DBI database handles. It also can
    form DSN strings for both major free databases and is subclassed to
    support extension for other databases.

    DBIx::DBH provides rigorous validation on the input parameters via
    Params::Validate. It does not allow parameters which are not defined by
    the DBI or the database driver driver into the hash.

    I provides support for MySQL, Postgres and Sybase (thanks to Rachel
    Richard for the Sybase support).

DBIx::DBH API
  $dbh = connect(%params)
    %params requires the following as keys:

    * driver : the value matches /\a(mysql|Pg|Sybase)\Z/ (case-sensitive).
    * dbname : the value is the name of the database to connect to

    %params can have the following optional parameters

    * user
    * password
    * host
    * port

    %params can also have parameters specific to a particular database
    driver. See DBIx::DBH::Sybase, DBIx::DBH::mysql and DBIx::DBH::Pg
    for additional parameters acceptable based on database driver.

  ($dsn, $user, $pass, $attr) = connect_data(%params)
    "connect_data" takes the same arguments as "connect()" but returns a
    list of the 4 arguments required by the DBI "connect()" function. This
    is useful for working with modules that have an alternative connection
    syntax such as DBIx::AnyDBD or Alzabo.

  ($dsn, $user, $pass, $attr) = connect_data(%params)
    "connect_data" takes the same arguments as "connect()" but returns a
    list of the 4 arguments required by the DBI "connect()" function. This
    is useful for working with modules that have an alternative connection
    syntax such as DBIx::AnyDBD or Alzabo.

  $dsn = form_dsn(%params)
    "form_dsn" takes the same arguments as "connect()" but returns only the
    properly formatted DSN string. This is also useful for working with
    modules that have an alternative connection syntax such as DBIx::AnyDBD
    or Alzabo.

SEE ALSO
    * Config::DBI
    * DBIx::Connect
    * DBIx::Password
    * Ima::DBI

TODO
    * expose parm validation info:
> > It would be nice if the parameter validation info was exposed in
        some > way, so that an interactive piece of software can ask a user
        which > driver they want, then query your module for a list of
        supported > parameters, then ask the user to fill them in. (Perhaps
        move the hash > of validation parameters to a new method named
        valid_params, and then > have connect_data call that method and pass
        the return value to > validate?)

AUTHOR
        Terrence Brannon, <bauhaus@metaperl.com>

        Sybase support contributed by Rachel Richard.

        Substantial suggestions by M. Simon Ryan Cavaletto.

COPYRIGHT AND LICENSE
        Copyright (C) 2004 by Terrence Brannon

        This library is free software; you can redistribute it and/or modify
        it under the same terms as Perl itself, either Perl version 5.8.4
        or, at your option, any later version of Perl 5 you may have
        available.

-- 
	Carter's Compass: I know I'm on the right track when,
	   by deleting something, I'm adding functionality.


Relevant Pages

  • Re: How can I open an SQL database and be the only one who has access to it?
    ... you can determine how SS permits access to your server. ... SINGLE_USER allows one user at a time to connect to the database. ... controlled by the termination clause of the ALTER DATABASE statement. ... To allow multiple connections, the database must be changed to ...
    (microsoft.public.data.ado)
  • Re: ORA-12518, 04030 errors after 9i-10G upgrade.
    ... All went ok until users started connecting in 100+ numbers, database is ... set up for dedicated server connections, this was never a problem in 9i. ... This did not solve problems so bounced database and decreased SGA to ... out of process memory errors. ...
    (comp.databases.oracle.server)
  • Re: ORA-12518, 04030 errors after 9i-10G upgrade.
    ... All went ok until users started connecting in 100+ numbers, database is ... set up for dedicated server connections, this was never a problem in 9i. ... out of process memory errors. ... that Oracle is having issues with OS resources. ...
    (comp.databases.oracle.server)
  • Re: ORA-12518, 04030 errors after 9i-10G upgrade.
    ... New server has 6GB ram. ... All went ok until users started connecting in 100+ numbers, database is ... set up for dedicated server connections, this was never a problem in 9i. ... This did not solve problems so bounced database and decreased SGA to ...
    (comp.databases.oracle.server)
  • Re: Proper Database Connection Cleanup
    ... but I think two of them have a database query in them. ... Public Sub ConnectToDB2(byref XCmd, byref YRS, byRef Conn) ... Set ObjRS = ObjCmd.Execute ... from DB connections in my code or from something else? ...
    (microsoft.public.scripting.vbscript)