SPUG: Re: DBD::CSV Problems
Aaron W. West
tallpeak at hotmail.com
Tue Apr 12 20:59:52 PDT 2005
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?
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
I feel a brief history is in order before I get to
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
DBI/DBD drivers installed within the last month
SQL::Statement is installed
Text::CSV_XS is installed
Here is the connect sub...
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.
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.7 - Release Date:
Seattle Perl Users Group Mailing List
POST TO: spug-list at pm.org
MEETINGS: 3rd Tuesdays, Location: Amazon.com Pac-Med
WEB PAGE: http://seattleperl.org/
More information about the spug-list