App-DBBrowser

 view release on metacpan or  search on metacpan

bin/db-browser  view on Meta::CPAN

database level.

=over

=item Fields

Set which fields are required to connect to a database.

=item Login Data

The entered login data is saved in a configuration file and used to connect to the database (the password cannot be
saved).

=item ENV Variables

The user can choose environment variables from a list of environment variables that should be used - if set - to connect
to the database.

=item Attributes

For the meaning of these driver-specific attributes, refer to the appropriate driver documentation.

lib/App/DBBrowser/DB.pm  view on Meta::CPAN

        return bless {}, $class;
    }

    sub get_db_driver {
        my ( $self ) = @_;
        return 'Pg';
    }

    sub get_db_handle {
        my ( $self, $db ) = @_;
        my $dbh = DBI->connect( "DBI:Pg:dbname=$db", 'user', 'password', {
            RaiseError => 1,
            PrintError => 0,
        });
        return $dbh;
    }

    sub get_databases {
        my ( $self ) = @_;
        return [ 'My_DB_1', 'My_DB_2' ];
    }

lib/App/DBBrowser/DB/DB2.pm  view on Meta::CPAN

sub get_db_driver {
    my ( $sf ) = @_;
    return 'DB2';
}


sub get_db_handle {
    my ( $sf, $db ) = @_;
    my $cred = App::DBBrowser::Credentials->new( $sf->{i}, $sf->{o} );
    # DBD::DB2 - Data Source Names:
    # Cataloged database connections can be done by passing the database alias, username, and password as parameters.
    # This method does not allow entering the host name, port number, etc but will require you to catalog the database
    # (local or remote) through DB2.
    my $dsn = "dbi:DB2:$db";
    my $show_sofar = 'DB '. $db;
    my $user = $cred->get_login( 'user', $show_sofar );
    $show_sofar .= "\n" . 'User: ' . $user if defined $user;
    my $passwd = $cred->get_login( 'pass', $show_sofar );
    my $dbh = DBI->connect( $dsn, $user, $passwd, {
        PrintError => 0,
        RaiseError => 1,



( run in 0.556 second using v1.01-cache-2.11-cpan-39bf76dae61 )