programming-examples/perl/Database/Available DBI Drivers and Data Sources.pl
2019-11-15 12:59:38 +01:00

22 lines
467 B
Perl

#!/usr/bin/perl
use warnings;
use strict;
use DBI;
my @drivers=DBI->available_drivers('quiet');
my @sources;
foreach my $driver (@drivers) {
print "$driver\n";
@sources=eval {
DBI->data_sources($driver)
};
if ($@) {
print "\tError: ",substr($@,0,60),"\n";
} elsif (@sources) {
foreach (@sources) {
print "\t$_\n";
}
} else {
print "\tNo known data sources\n";
}
}