SPUG: Re: DBD::CSV Problem Solved

Jim Clark entropy at zipcon.com
Wed Apr 13 12:59:15 PDT 2005


That's it.  Problem solved.

Thank you all.

JC

*********** REPLY SEPARATOR  ***********

On 4/12/2005 at 8:59 PM Aaron W. West wrote:

>Note that you specified a file name, not a directory name, as if 
>it were a directory containing CSV files.
>
>Try Text::CSV_XS for parsing text that's already in a file.
>
>Or try creating a table within the CSV "database" (datasource) to 
>see how the DBD driver organizes and names its files.
>
>Did you read the docs?
>
>http://search.cpan.org/~jzucker/DBD-CSV-0.22/lib/DBD/CSV.pm
>
>This might work:
>  my $dbh = DBI->connect( "DBI:CSV:f_dir=/home/jc/data/" ) ;
>  my $sth = $dbh->prepare("SELECT * FROM yahoo.csv");
> ...
>
>
>----- Original Message ----- 
>From: "Jim Clark" <entropy at zipcon.com>
>To: <spug-list at pm.org>
>Sent: Tuesday, April 12, 2005 8:06 PM
>Subject: SPUG: DBD::CSV Problems
>
>
>Hi All,
>  I feel a brief history is in order before I get to
>my problem.
>
>I retired in 2002 and have not cut a line of production
>code since July of that year.  A former co-worker asked me
>to crunch some data for the small business he started.  Being
>out of the workforce for a while, I'm definitely not
>up to date with perl so I may ask stupid questions.
>
>That being said, here is my problem.
>
>I have some .csv files I need to read, parse and
>write.  I planned on using DBI/DBD.  I have been
>unable to open the csv files with a connect.
>I have a lot of experience with DBD::Oracle
>but am at an empass with DBD::CSV.  I'm not looking
>forward to writing code to parse a csv file.
>
>Here is where I'm at...
>
>OS RH 9.2
>Perl 5.8.0
>DBI/DBD drivers installed within the last month
>SQL::Statement is installed
>Text::CSV_XS is installed
>
>Here is the connect sub...
>
>sub connect_to_yahoo
>{
>
>  my $dbh = DBI->connect( 
>"DBI:CSV:f_dir=/home/jc/data/yahoo.csv" ) ;
>
>  return  ( $DBI::err ? 0 : $dbh ) ;
>
>}
>
>and the error message
>
>No such directory '/home/jc/data/yahoo.csv' at ./dbtest.pl line 27
>
>The directory and the file definitely exist.
>
>Any help would be greatly apprecieated.
>
>Thanks,
>
>JC
>
>
>
>
>
>-- 
>No virus found in this outgoing message.
>Checked by AVG Anti-Virus.
>Version: 7.0.308 / Virus Database: 266.9.7 - Release Date: 
>4/12/2005
>
>_____________________________________________________________
>Seattle Perl Users Group Mailing List
>     POST TO: spug-list at pm.org
>SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list
>    MEETINGS: 3rd Tuesdays, Location: Amazon.com Pac-Med
>    WEB PAGE: http://seattleperl.org/
>
>
>
>-- 
>No virus found in this incoming message.
>Checked by AVG Anti-Virus.
>Version: 7.0.308 / Virus Database: 266.9.7 - Release Date: 4/12/2005





-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.7 - Release Date: 4/12/2005



More information about the spug-list mailing list