#!/Perl/bin/perl -w use DBI; use DBD::mysql; use CGI; my $dbh = DBI->connect( 'DBI:mysql:logarit:localhost', '', '', { PrintError => 1, RaiseError => 1, "AutoCommit" => 1, }, ) or print STDERR ( "Error in connecting to DBI:mysql:logarit:localhost\n", die => 1); # immer Returncodes und Fehler auswerten!!! my $cmd = qq~ SELECT BINARY grafik FROM grafik WHERE name='noname' ~; my $sth = $dbh->prepare($cmd) or die $!; $sth->execute() or die $!; binmode STDOUT; print "Content-type: image/gif\n\n"; my $grafik = $sth->fetchrow_array(); print $sth->fetchrow_array(); $sth->finish(); $dbh->disconnect(); exit(0);