If you use f_ext => ".csv/r", you explicitly tell the driver that the extension is required. If you add the /r, you should not add .csv to the table name. The driver will still be able to open your file, but it is not quaranteed anymore which file it opens: newCsv, newCsv.csv, or newCsv.csv.csv.

Another issue is case sensitivity. On Windows newCsv will match against any casing. On Linux you might need to check if your file name matches.

$ cat newCsv.csv foo,bar,baz 1,2,3 $ perl -MDP -MDBI -e'my$s=DBI->connect("dbi:CSV:",undef,undef,{f_ext=> +".csv/r"})->prepare("select * from newCsv");$s->execute;DDumper$s->fe +tchrow_hashref' { bar => 2, baz => 3, foo => 1 } $ perl -MDP -MDBI -e'my$s=DBI->connect("dbi:CSV:",undef,undef,{f_ext=> +".csv/r"})->prepare("select * from newCsv.csv");$s->execute;DDumper$s +->fetchrow_hashref' { bar => 2, baz => 3, foo => 1 } $ perl -MDP -MDBI -e'my$s=DBI->connect("dbi:CSV:",undef,undef,{f_ext=> +".csv/r"})->prepare("select * from newcsv");$s->execute;DDumper$s->fe +tchrow_hashref' DBD::CSV::st execute failed: Execution ERROR: Cannot open /tmp/ne.csv: No such file or directory (2 +) at /pro/lib/perl5/site_perl/5.24.0/x86_64-linux-thread-multi-ld/DBI +/DBD/SqlEngine.pm line 1624. . [for Statement "select * from newcsv"] at -e line 1. DBD::CSV::st fetchrow_hashref failed: Attempt to fetch row without a p +receding execute () call or from a non-SELECT statement [for Statemen +t "select * from newcsv"] at -e line 1. undef

I see that the error message could use some improvement :)


Enjoy, Have FUN! H.Merijn

In reply to Re: DBD::CSV::st execute failed: by Tux
in thread DBD::CSV::st execute failed: by Sandy_Bio_Perl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.