Are you uisng activestate Perl? You will also have to insall DBD::Oracle and an instantclient as well. If not you will have to compile DBD::Oracle yourself (takes a little while but it can be done) see the windows readmes to find instrunctions Cheers John Scoles
> Date: Fri, 29 Apr 2011 20:38:12 +1000 > Subject: Re: Help Needed for DBI > From: rc...@pcug.org.au > To: vikrant....@rbs.co.uk > CC: dbi-users@perl.org > > > Hello, > > I am really struggling to connect to database, I am not sure how to > > ensure that I HAVE DBI sintalled and if not then how to make it > > activate > > it on my machine, I have perl installed but when I give the following > > command on my command prompt then > > > > perl -e 'use DBI; print $DBI::VERSION,"\n";' it gives following > > errorcd c\ > > Can't find string terminator "'" anywhere before EOF at -e line 1. > > It works for me! > owen@owen-desktop:~$ perl -e 'use DBI; print $DBI::VERSION,"\n";' > 1.607 > owen@owen-desktop:~$ > > But you are on Windows, and there is always some problem with single > and double quotes. > > I think windows does not allow single quotes, so try that with double > quotes, eg # perl -e "use DBI; print $DBI::VERSION,"\n";" > > > > > > > > > Also when I am exccuting a database program it gives the following > > highlighted error, any help on this will be higly appreciated... > > #!/usr/bin/perl -w > > use strict; > > use dbi(); > > use lib; > > > > > > my $dbh = dbi->connect('dbi:Oracle:****', > > '****', > > '****', > > { > > RaiseError => 1, > > AutoCommit => 0 > > } > > )|| die "Database connection not made: > > $dbi::errstr"; > > my $sql = qq{ SELECT * FROM tab where rownum<3 }; > > my $sth = $dbh->prepare( $sql ); > > $sth->execute(); > > $dbh->disconnect(); > > Name "dbi::errstr" used only once: possible typo at C:\seven.pl line > > 14. > > Can't locate object method "connect" via package "dbi" at C:\seven.pl > > line 7. > > > Again, my lack of windows knowledge fails me, and maybe capitalization > doesn't matter, but the package is DBI, so I would have written, > > use DBI; > ... > my $dbh = DBI->connect('dbi:Oracle:****', ... > > Again, perhaps the single quotes may cause a problem, try double > quotes if need be > > > > Owen > > > >