Search This Blog

Saturday, May 8, 2010

Getting DB Drivers using Perl DBI

Following module is used for getting the database driver details using Perl DBI module.
If DBI is not found under your installation directory you can get it from following CPAN network site: CPAN - DBI

#!C:/Pratap-Apache/perl-5.10.0/bin/perl.exe

use DBI;
my @drivers = DBI->available_drivers('quiet');
my @sources;

foreach my $driver (@drivers){
printf "$driver \n";
@sources = eval { DBI->data_sources($driver)};
if (@sources){
foreach(@sources){
printf($_);
printf "\n";
}
}
else{
printf "No sources found !!! \n\n";
}
}

In case of any queries, you can reach out to me at :
Email to Prat