User Tools

Site Tools


kurs:dbd

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

kurs:dbd [2014/09/10 21:22]
kurs:dbd [2014/09/10 21:22] (current)
Line 1: Line 1:
 +<​code>​
 +use DBI;
  
 + my $dbh = DBI->​connect('​DBI:​Proxy:​hostname=makabaer.cc.univie.ac.at;​port=1002;​dsn=dbi:​Oracle:',​ '​user'​
 +, '​passwd'​)
 +        or die "​Couldn'​t connect to database: " . DBI->​errstr;​
 +
 +
 + my $sth = $dbh->​prepare('​SELECT per_name, per_nicat_handle FROM NIC_Personen WHERE PER_NAME = :​name'​)
 +                or die "​Couldn'​t prepare statement: " . $dbh->​errstr;​
 +
 +
 +          my @data;
 +          $sth->​bind_param(':​name',​ "​Hofstetter"​);​
 +          $sth->​execute($lastname) ​            # Execute the query
 +            or die "​Couldn'​t execute statement: " . $sth->​errstr;​
 +
 +
 +          while (@data = $sth->​fetchrow_array())
 +                {
 +            my $firstname = $data[1];
 +            my $id = $data[2];
 +            #print "​$data[1] $id $data[3]\n";​
 +            print @data;
 +        }
 +
 +        $sth->​finish;​
 +</​code>​
kurs/dbd.txt ยท Last modified: 2014/09/10 21:22 (external edit)