Mach mal:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/perl -w
#DatenbankAbfragen
use strict;
use warnings;
use DBI;
open(DAT, '<','../gate_common/MySQLAccount.txt') or die"Could not open SQL-Data-file!";
my $raw_data=<DAT>;
close(DAT);
chomp $raw_data;
my ($host,$user,$pass,$db) = split(/:/, $raw_data);
print "host ".$host."\n"."user ".$user."\n"."pass ".$pass."\n"."db ".$db."\n";
my $dbh = DBI->connect("DBI:mysql:".$db.":".$host,$user,$pass) or die "Connect Error: $DBI::errstr()\n";
Query($dbh);
$dbh->disconnect;
sub Query{
my ($dbh) = @_;
my @ergebnisse;
my $query = "SELECT ID, NEID, TS, BState, Data_CISCO, MD5 FROM RC_CISCO";
my $sth = $dbh->prepare($query) or die "Querry Error prepare: $DBI::errstr\n";
$sth->execute or die "Querry Error execute: $DBI::errstr\n";
while(my @row = $sth->fetchrow_array()){
# push(@ergebnisse,\@row);
print "@row\n";
}
$sth->finish();
}
\n\n
<!--EDIT|renee|1165311869-->