http://www.perlmonks.org?node_id=70164


in reply to DBD Drivers query

When I run your script, an error about DBD::Proxy and the mysql driver info is never displayed. I believe the problem has something to do with this line, though I'm not sure what the actual problem is:

my @datasources = DBI->data_sources($driver);

If I remove the statements that deal with the data_sources, it works fine:

#!/usr/bin/perl use strict; use DBI; my @drivers = DBI->available_drivers(); die "No drivers found!\n" unless @drivers; foreach my $driver ( @drivers ) { print "Driver: $driver\n"; }

Which returns:

Driver: ADO Driver: ExampleP Driver: Oracle Driver: Pg Driver: Proxy Driver: mysql

Maybe DBD::Proxy has a problem with data_sources?

Replies are listed 'Best First'.
Re: Re: DBD Drivers query
by costas (Scribe) on Apr 06, 2001 at 12:41 UTC
    Sutch, this works exactly the same for me.

    Once I removed that line I get

    Driver: ExampleP Driver: Multiplex Driver: Proxy Driver: mysql

    Does this glitch have any affect on any of the drivers (in particular mysql). Are these driver working functionaly, as normal, in other words will i have any problems using these drivers later on?
      Without reading up too much about why DBD::Proxy may be choking on the data_sources call, I did find that DBD::Proxy should not have any effect on Mysql. From the DBD::Proxy documentation:

      DBD::Proxy is a Perl module for connecting to a database via a remote DBI driver.

      This is of course not needed for DBI drivers which already support connecting to a remote database, but there are engines which don't offer network connectivity.

      I would suggest limiting your data_sources method calls to only driver(s) that your are going to use. For example, use a conditional such as if ($driver eq 'mysql') so that only the mysql driver is queried for data_sources.

        That is what i have done.

        Also note that DBD::Multiplex also has a problem with datasources!!