#!/usr/bin/perl -w #DatenbankAbfragen use strict; use warnings; use Mysql; our $dbh; my @raw_data; my @sqldata; my $rc; sub Query{ my $query; my $sth; my $execu; my $newdata; my $ds; my @ergebnisse; my @row; $query = "SELECT RC_CISCO.ID, RC_CISCO.NEID, RC_CISCO.TS, RC_CISCO.BState,RC_CISCO.Data_CISCO,RC_CISCO.MD5 FROM RC_CISCO"; $sth = $dbh->prepare($query) or die "Querry Error prepare: $DBI::errstr\n"; $ds = $sth->execute or die "Querry Error execute: $DBI::errstr\n"; while(my @row = $sth->fetchrow_array()) { push(@ergebnisse,\@row); #print "ID:$newdata->{ID} Name:$newdata->{NEID} Name:$newdata->{BState} Name:$newdata->{Data_CISCO} Name:$newdata->{MD5}\n"; } $sth->finish(); } open(DAT, "../gate_common/MySQLAccount.txt") || die("Could not open SQL-Data-file!"); @raw_data=; close(DAT); @sqldata = split(/:/, $raw_data[0]); print "host ".$sqldata[0]."\n"."user ".$sqldata[1]."\n"."pass ".$sqldata[2]."\n"."db ".$sqldata[3]."\n"; $dbh = DBI->connect("DBI:mysql:".$sqldata[3].":".$sqldata[0],$sqldata[1],$sqldata[2])|| die "Connect Error: $DBI::errstr()\n"; Query; $rc = $dbh->disconnect;