#!/Perl/bin/perl use strict; use warnings; use DBI; use Config::Auto; use Data::Dumper qw/Dumper/; my $config = Config::Auto::parse('test_mysql.config'); my $dsn = $config->{dsn}; my $username = $config->{username}; my $password = $config->{password}; my $options = { AutoCommit => 1, }; my $dbh = DBI->connect($dsn, $username, $password, $options) or die "cannot connect to db: " . DBI::errstr(); my $stmt = "SELECT * FROM testabelle"; my $sth = $dbh->prepare($stmt) or die "error prepare: " . $dbh->errstr(); my $rv = $sth->execute() or die "error execute: " . $dbh->errstr();; if( $rv == "0E0" ) { print "keine Werte"; }else{ while( my $href = $sth->fetchrow_hashref() ) { print Dumper $href; } } $sth->finish(); $dbh->disconnect();