NAME

DBIx::CheckConnectivity - util to check database's connectivity

SYNOPSIS

use DBIx::CheckConnectivity;
my ( $ret, $msg ) = check_connectivity( dsn => 'dbi:mysql:database=myjifty', user => 'jifty',
        password => 'blabla' );

if ( $ret ) {
    print 'we can connect';
}
else {
    warn "can not connect: $msg";
}

DESCRIPTION

INTERFACE

check_connectivity ( dsn => $dsn, user => $user, password => $password, attribute => $attribute )

return 1 if success, undef otherwise. in list context, if connect fails, returns a list, the 1st one is undef, the 2nd one is the error message.

DEPENDENCIES

DBI, Params::Validate, UNIVERSAL::require

BUGS AND LIMITATIONS

No bugs have been reported.

currently, only mysql, Pg and SQLite are supported.

AUTHOR

sunnavy <sunnavy@bestpractical.com>

LICENCE AND COPYRIGHT

Copyright 2009 Best Practical Solutions.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.