in reply to Is setting $ENV{'NLS_LANG'} deprecated?
It's good to know that I'm not trying to do something deprecated - but, unfortunately, so far none of your replies has helped to disclose the secret behind the difference between Perl 5.6.1/DBI 1.40 and Perl 5.8.6/DBI 1.601 in this case:
@derby: I suppose by "OCI" you meant "Oracle::OCI". Interestingly, for both(!) of the mentioned Perl versions
returns$> perl -MDBD::Oracle -e 'print "$DBD::Oracle::VERSION\n"'
andCan't load '/.../<PERL_VERSION>/sun4-solaris/auto/DBD/Oracle/Oracle +.so' for module DBD::Oracle: ld.so.1: perl: fatal: libclntsh.so.9.0: +open failed: No such file or directory at /.../<PERL_VERSION>/sun4-so +laris/DynaLoader.pm line <LINE_NUMBER>.
returns$> perl -MOracle::OCI -e 'print "$Oracle::OCI::VERSION\n"'
so it seems neither of these modules is used (at least by the working duo Perl 5.6.1 and DBI 1.40) anyway. See below for a complete code example if you like.Can't locate Oracle/OCI.pm in @INC (@INC contains: ...)
@mje, Tux, and cmdrake: Yes, I do set NLS_LANG before connecting to the database and I tried both setting it in the environment and setting it within a BEGIN block at the beginning of my Perl script. Even replacing UTF8 by AL32UTF8 didn't help with Perl v5.8.6/DBI v1.601 (while it didn't hurt with Perl v5.6.1/DBI v1.40).
Of course, I'm happy to share my code with you in order to provide more detailed information. I'm using a csh wrapper script
#!/bin/csh # NOTE: '...' is a placeholder for one or more levels of subdirectorie +s setenv ORACLE_HOME "/.../oracle/product/920" setenv LD_LIBRARY_PATH $ORACLE_HOME/lib32:/usr/lib:/usr/ucb/lib setenv ORA_NLS33 $ORACLE_HOME/ocommon/nls/admin/data setenv NLS_LANG AMERICAN_AMERICA.AL32UTF8 setenv LD_PRELOAD /usr/lib/libthread.so.1 /.../perldbi_with_al32utf8.pl "$1"
#!/...path...to...desired...version...of.../perl use strict; use warnings; use DBI; # Load the DBI module ### Attributes to pass to DBI->connect() to disable automatic error ch +ecking my %attr = ( PrintError => 0, RaiseError => 0, ); ### Connect using the Oracle driver my $dbh = DBI->connect("DBI:Oracle:", "user", "password", \%attr ) or die "Can't connect to database: ", $DBI::errstr, "\n"; ### Be prepared for long fields $dbh->{LongReadLen} = 100000; ### Prepare the SQL statement for execution my $sth = $dbh->prepare( "$ARGV[0]" ) or die "Can't prepare SQL statement: ", $dbh->errstr(), "\n"; ### Execute the statement in the database $sth->execute or die "Can't execute SQL statement: ", $sth->errstr(), "\n"; ### Retrieve the returned rows of data my @row; while ( @row = $sth->fetchrow_array() ) { print @row, "\n"; } warn "Problem in fetchrow_array(): ", $sth->errstr(), "\n" if $sth->err(); $sth->finish; ### Disconnect from the database $dbh->disconnect or warn "Failed to disconnect: ", $dbh->errstr(), "\n"; exit;
Do you spot anything suspicious?
Best regards
Locutus
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Is setting $ENV{'NLS_LANG'} deprecated?
by cmdrake (Acolyte) on Dec 16, 2008 at 03:28 UTC | |
by Locutus (Beadle) on Feb 17, 2009 at 14:59 UTC |