Do you have a question? Post it now! No Registration Necessary. Now with pictures!
March 9, 2006, 4:18 pm
rate this thread
Is anyone know if its possible to use Excel DBD on unix machine,
I tried to do it, after installation of all packges i ran the most
popular sctipt in the net:
$hDb = DBI->connect("DBI:Excel:file=test.xls")
or die "Cannot connect: " . $DBI::errstr;
$hSt = $hDb->prepare("CREATE TABLE a (id INTEGER, name CHAR(10))")
or die "Cannot prepare: " . $hDb->errstr();
$hSt->execute() or die "Cannot execute: " . $hSt->errstr();
but always receive an error:
DBI connect('file=test.xls','',...) failed: (no error string) at
test.pl line 2
Cannot connect: at test.pl line 2.
Thanks in advance
Re: DBD:Excel on unix machine
Does your xls file exist?
I get that error when the xls file I am trying to open does not exist.
To hunt down the problem, I've tried to make the DBD::Excel module give
better error messages by making this change:
#3.check file and parse it
$DBD::Excel::errstr="No file given", return undef unless($hDb->);
my $oExcel = new Spreadsheet::ParseExcel::SaveParser;
my $oBook = $oExcel->Parse($hDb->, $rhAttr->);
$DBD::Excel::errstr="Can't seem to get a book from your excel file",
return undef unless defined $oBook;
Since I've never dealt with DBD internals before, this very well might not
be the right way to do this--I can only claim it was right enough to help
me track this specific problem down.
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB