Thanks......so much... -----Original Message----- From: Owen [mailto:rc...@pcug.org.au] Sent: Friday, April 29, 2011 11:38 AM To: Rai, Vikrant (GIS, Technology Services India) Cc: dbi-users@perl.org Subject: Re: Help Needed for DBI
> 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 *** WARNING : This message originates from the Internet *** The Royal Bank of Scotland plc, Registered in Scotland No. 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB Authorised and regulated by the Financial Services Authority. This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate.