Hector.Albertos has asked for the wisdom of the Perl Monks concerning the following question:

I have tested in the below method :I am not sure if we have any other alternative to test the database connectivity

I have used the below code to connect to the SQL database :

my $dbh = DBI->connect($DBSERVER, $DBUSERID, $DBPASSWD) or die "Can't connect to $DBSERVER: $DBI::errstr";

The $ DBSERVER parameter should contain the value “dbi::driver_name”. The driver_name specifies the driver that is used to make the connection

I tried to pull the installed drivers using the below command “@ary = DBI->available_drivers; “ and the value returned is “DBMExamplePFileGoferProxySponge$”.

When tried to run the datasource with the ‘DBMExamplePFileGoferProxySponge’ driver the connection failed with the message “install_driver(DBMExamplePFileGoferProxySponge$) failed:”

Replies are listed 'Best First'.
Re: Add database connectivity with Perl
by hangon (Deacon) on May 20, 2009 at 22:59 UTC

    As Jenda stated, you need to install the appropriate driver for your database. The drivers you show come with the DBI installation, and with the exception of DBM, they are special purpose drivers that you would not normally use to connect to a database.

    Once you've determined the databases you need to connect to, Search CPAN for DBD drivers and install what you need. The connect method parameters can vary somewhat between drivers, so be sure to check the drivers' documentation.

Re: Add database connectivity with Perl
by DStaal (Chaplain) on May 20, 2009 at 20:36 UTC

    My first thought is that you did something like "print @ary;", which would have stuck all the elements of the array together and printed them on one line.

    Try "print "@ary\n";": My bet is that there will be spaces, and you can pick one of the drivers installed...

      Well looking at the list you will most likely have to install some driver. First you should know what database do you want to connect to or what operating system is your script running under. If you're using Windows, it's quite likely you'll want to install DBD::ODBC.

      Jenda
      Enoch was right!
      Enjoy the last years of Rome.