Listing Valid DSNs : DBI « Database « Perl






Listing Valid DSNs

   


#!/usr/bin/perl

use strict;
use DBI;

my @drivers;
@drivers = DBI->available_drivers;

foreach my $driver (@drivers) {
  print "$driver driver is available\n";
  my @dsns = DBI->data_sources($driver);
  foreach my $dsn (@dsns) {
    print "\tDSN: $dsn\n";
  }
}

   
    
    
  








Related examples in the same category

1.Listing Currently Installed Drivers
2.Talking with the Database
3.The connect() Method
4.Use DBI to connect to a database
5.Connect to Oracle
6.Connect to mysql
7.Binding Columns
8.Available DBI Drivers and Data Sources