For Programmers: Free Programming Magazines  


Home > Archive > PERL Modules > March 2006 > DBD:Excel on unix machine









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author DBD:Excel on unix machine
yan.vulich@gmail.com

2006-03-09, 6:55 pm

Hi, folks.
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:
use DBI;
$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();
$hSt->finish();
$hDb->disconnect();

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.

PLEASE HELP
Thanks in advance

xhoster@gmail.com

2006-03-09, 6:55 pm

yan.vulich@gmail.com wrote:
> Hi, folks.
> 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:
> use DBI;
> $hDb = DBI->connect("DBI:Excel:file=test.xls")
> or die "Cannot connect: " . $DBI::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.
>
> PLEASE HELP


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->{file});
my $oExcel = new Spreadsheet::ParseExcel::SaveParser;
my $oBook = $oExcel->Parse($hDb->{file}, $rhAttr->{xl_fmt});
$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.


Xho

--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com