Name

data_sources( )

Synopsis

DBI->data_sources([driver, \%attributes])

This returns a list of databases associated with a given driver. If none is specified, the driver named in the environment variable DBI_DRIVER is used. Attributes may be given as a second argument.

...
my @drivers = DBI->available_drivers( );
      || die "No drivers found.";
foreach my $driver(@drivers) {
   my @sources = DBI->data_sources($driver);
   foreach my $source(@sources) {
      print "$driver:  $source\n";
   }
}

Get MySQL in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.