|< 1 2 >| | 13 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/perl -w
use strict;
use DBI();
my $db_name;
my $dbh = DBI->connect("DBI:mysql:database=dbname;host=localhost",
"username", "Password",
{ 'RaiseError' => 1 });
my $sth = $dbh->prepare("SHOW DATABASES");
$sth->execute();
while($db_name = $sth->fetchrow_array( ))
{
print "$db_name\n";
}
Quote\n\ndata_sources
@ary = $dbh->data_sources();
@ary = $dbh->data_sources(\%attr);
Returns a list of data sources (databases) available via the $dbh driver's data_sources() method, plus any extra data sources that the driver can discover via the connected $dbh. Typically the extra data sources are other databases managed by the same server process that the $dbh is connected to.
Data sources are returned in a form suitable for passing to the "connect" method (that is, they will include the "dbi:$driver:" prefix).
The data_sources() method, for a $dbh, was added in DBI 1.38.
|< 1 2 >| | 13 Einträge, 2 Seiten |