in reply to Re^2: Trouble getting DBD::CSV to work
in thread Trouble getting DBD::CSV to work

Your original post said "dbi:CSV:f_dir:/root, which was obviously wrong, and thus most likely the cause of failure.

Assuming you have recent enough versions of the modules you use, what is the output of:

use strict; use warnings; use DBI; my $dbh = DBI->connect ("dbi:CSV:", undef, undef, { f_dir => "/root", f_ext => ".csv/r", RaiseError => 1, PrintError => 1, ShowErrorStatement => 1, }); print "DBI-$DBI::VERSION\n"; print "DBD::CSV-$DBD::CSV::VERSION\n"; print "Text::CSV_XS-$Text::CSV_XS::VERSION\n"; print "SQL::Statement-$SQL::Statement::VERSION\n"; print "\n"; print "$_\n" for $dbh->tables (undef, undef, undef, undef);

Enjoy, Have FUN! H.Merijn

Replies are listed 'Best First'.
Re^4: Trouble getting DBD::CSV to work
by paulski82 (Novice) on Aug 05, 2014 at 09:00 UTC
    DBI-1.609 DBD::CSV-0.22 Text::CSV_XS-0.85 SQL::Statement-1.27 "root".export "root".export3 "root".export2

      A lot has changed since DBD-CSV-0.22! That version was from April 2005.

      At the moment of writing, the current versions are:

      DBI-1.631 DBD::CSV-0.44 Text::CSV_XS-1.10 SQL::Statement-1.405

      My first hunch would be, with your old versions, to add the schema:

      my $sth = $dbh->prepare (q{select * from "root".export}); $sth->execute; while (my $h = $dbh->fetchrow_hashref) { # Don't know if casing of fieldnames is sane in those versions # YMMV, $dbh->{FetchHashKeyName} = "NAME_lc"; might help print "ID: ", $h->{id}, ", SN: ", $h->{service_name}; }

      Enjoy, Have FUN! H.Merijn

        I'm running RHEL6, with the packaged PERL. So I rebuilt the latest stable PERL (v5.20.0) from source and installed the latest dependencies.

        DBI-1.631
        DBD::CSV-0.44
        Text::CSV_XS-1.10
        SQL::Statement-1.405

        This seems to have done the trick. It's not ideal, since I have to maintain the source built version. I'll log a bug with Red Hat to see if they can patch it into the next update.

        Thanks for you help