NAME

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

VERSION

This document describes DBIx::CheckConnectivity version 0.01

SYNOPSIS

use DBIx::CheckConnectivity;
if ( check_connectivity( dsn => 'dbi:mysql:database=myjifty', user => 'jifty',
        password => 'blabla' ) ) {
    print 'we can connect';
}
else {
    warn "can not connect: $DBIx::CheckConnectivity::ERROR";
}

DESCRIPTION

INTERFACE

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

return 1 if success, undef otherwise.

if $AUTO_CREATE is set to true and the db has not been created yet, this sub will try to create the db, return 1 if success, undef otherwise.

the error message is stored in $ERROR

DEPENDENCIES

DBI, Params::Validate

INCOMPATIBILITIES

when we connect a SQLite source, if the db doesn't exist, DBI will try to create the db automatically, so even $AUTO_CREATE is set to false, connect to a non-exist SQLite source will try to create the db anyway.

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.