App-DBBrowser
view release on metacpan or search on metacpan
bin/db-browser view on Meta::CPAN
considered depend on the plugin.
=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
my $db_opt_get = App::DBBrowser::Opt::DBGet->new( $sf->{i}, $sf->{o} );
my $db_opt = $db_opt_get->read_db_config_files();
my $login_data = $db_opt_get->get_login_data( $db, $db_opt );
my $env_var_yes = $db_opt_get->enabled_env_vars( $db, $db_opt );
my $read_attributes = $db_opt_get->get_read_attributes( $db, $db_opt );
my $set_attributes = $db_opt_get->get_set_attributes( $db, $db_opt );
my $cred = App::DBBrowser::Credentials->new( $sf->{i}, $sf->{o} );
my $settings = { login_data => $login_data, env_var_yes => $env_var_yes };
# 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:$sf->{i}{driver}:$db";
my $show_sofar = 'DB '. $db;
my $user = $cred->get_login( 'user', $show_sofar, $settings );
$show_sofar .= "\n" . 'User: ' . $user if defined $user;
my $passwd = $cred->get_login( 'pass', $show_sofar, $settings );
my $dbh = DBI->connect( $dsn, $user, $passwd, {
PrintError => 0,
RaiseError => 1,
( run in 0.801 second using v1.01-cache-2.11-cpan-49f99fa48dc )