goso has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks, I'm having trouble connecting to SQL Server (error message listed below) and my searches haven't found a scenario similar to mine. I've both DBI and DBD-ODBC installed, I ended up installing them via the CPAN shell, I've a feeling I need to redo the installs. If so, do I delete the files in C:\Perl\cpan\build ? Or what are the steps to get rid of any files/modules associated with these installs and start from scratch? Can you give me guidance on this problem? Thanks very much. Troubleshooting: * I'm able to connect via ADO. * I've added various 'use lib' lines (to no avail) such as: use lib "C:/Perl/cpan/build/"; Error Message: Can't locate auto/DBI/connection.al in @INC(@INC contains: C:/Perl/site/lib/ C:/Perl/site/lib C:/Perl/lib .) at testscript.pl line 40 Other notes: * I'm new to Perl * I'm running ActivePerl on WinXP * my script follows: use DBI; my $dbh = DBI -> connection("DBI:ODBC:xxxxxxx"); die "connect prob: " . DBI -> errstr() unless $dbh; print "db connected"; $dbh -> discconnect();
  • Comment on Can't locate auto/DBI/connection.al in @INC

Replies are listed 'Best First'.
Re: Can't locate auto/DBI/connection.al in @INC
by Corion (Patriarch) on Apr 13, 2008 at 16:10 UTC

    There is no ->connection method in DBI. Maybe you wanted ->connect?

    Your posted script does not seem to match the error message you posted. It does not produce the "Troubleshooting" output and it does not have 40 lines. Please, when you post, post the actual script together with the error message produced by the script.

    As an aside, your post is not formatted. Please use <code>...</code> tags around your code and <p>...</p> tags to format your prose.

      Thanks very much for your help Corion :)

      I focused so much on the error message that I didn't recheck the code, strangely the IDE syntax check didn't catch the ->connection typo.

      I'll be sure to show code and error messages verbatim as well as wrap my content in proper tags in the future. Thanks for pointing them out. Bow