paresh2011 has asked for the wisdom of the Perl Monks concerning the following question:

This error i get when i run a Hallow world program in this env Database = Oracle 10g ActivePerl-5.14.0.1400-MSWin32-x86-294816
#!/usr/local/bin/perl use strict; use DBI; # Connect to Oracle database, making sure AutoCommit is # turned off and potential errors are raised. my $dbh = DBI->connect( 'dbi:Oracle:orcl', 'scott', '**', { RaiseError => 1, AutoCommit => 0 } ); # Create the SQL. my $sql = qq{ SELECT 'Hello World' FROM DUAL }; # Prepare the SQL and execute. my $sth = $dbh->prepare( $sql ); $sth->execute( ); # Fetch output rows into array, plus prepare a # print formatter for the results. while ( my($helloWorldString) = $sth->fetchrow_array) { # Print out the result. print $helloWorldString, "\n"; } $dbh->disconnect( ); # Disconnect
Error:--- cmpilation failed in required at E:\perl\d.pl line 5

Perl lib version (v5.6.1) doesn't match executable version (v5.14.0) at E:\oracle\product\10.1.0\Db_2\perl\5.6.1\lib\MSWin32-x86/Config.pm line 21. Compilation failed in require at E:\oracle\product\10.1.0\Db_2\perl\5.6.1\lib\MSWin32-x86/DynaLoader.pm line 25. BEGIN failed--compilation aborted at E:\oracle\product\10.1.0\Db_2\perl\5.6.1\lib\MSWin32-x86/DynaLoader.pm line 25. Compilation failed in require at E:\oracle\product\10.1.0\Db_2\perl\site\5.6.1\lib/DBI.pm line 152. BEGIN failed--compilation aborted at E:\oracle\product\10.1.0\Db_2\perl\site\5.6.1\lib/DBI.pm line 152. Compilation failed in require at E:\Perl\d.pl line 5. BEGIN failed--compilation aborted at E:\Perl\d.pl line 5.

Replies are listed 'Best First'.
Re: Error during connecting oracle 10g
by Corion (Patriarch) on Jun 19, 2011 at 07:22 UTC

    Is all this code really necessary? It would seem to me that the following program should behave the same:

    #!perl -w use strict; use DBI;

    You have two versions of Perl installed, one that came with Oracle (E:\oracle\product\10.1.0\Db_2\perl\5.6.1\) and the other (E:\Perl\). They are getting mixed up, maybe because you have set PERL5LIB or some other environment variable. Clean up the directory settings and make sure that each Perl only sees the correct directories.