> 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