DBD:Excel on unix machine
am 09.03.2006 17:18:44 von yan.vulich
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
Re: DBD:Excel on unix machine
am 09.03.2006 19:58:10 von xhoster
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