Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Perl to Oracle Connection Error: ERROR OCINlsEnvironmentVariableGet(OCI_NLS_CHARSET_ID)

by fattahsafa (Sexton)
on Dec 16, 2014 at 08:21 UTC ( #1110461=perlquestion: print w/replies, xml ) Need Help??
fattahsafa has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to connect to a remote oracle database in my perl app. When running the app, the following error appears:  "Connection Error: ERROR OCINlsEnvironmentVariableGet(OCI_NLS_CHARSET_ID)" I got Oracle Instant Client and placed it locally then set the Oracle Home env to it, as I don't have Oracle client installed there. My code is below:
BEGIN { $ENV{NLS_LANG} = "AMERICAN_AMERICA.UTF8"; $ENV{OCI_NLS_CHARSET_ID} = "AMERICAN_AMERICA.UTF8"; $ENV{ORACLE_HOME} = #The path to the instant Oracle client"; } #Connect to database my $DBHandle = DBI->connect( "dbi:Oraclehost=$host;sid=$sid;port=$port", $userName, $passWord ) or die "Connection Error: $DBI::errstr\n";
I'm using ActiveStat perl on Windows Server 2008, ORACLE 10g
  • Comment on Perl to Oracle Connection Error: ERROR OCINlsEnvironmentVariableGet(OCI_NLS_CHARSET_ID)
  • Select or Download Code

Replies are listed 'Best First'.
Re: Perl to Oracle Connection Error: ERROR OCINlsEnvironmentVariableGet(OCI_NLS_CHARSET_ID)
by Corion (Pope) on Dec 16, 2014 at 08:54 UTC

    In your code, you set OCI_NLS_CHARSET_ID, and Oracle complains about OCI_NLS_CHARSET_ID. Maybe the value of OCI_NLS_CHARSET_ID is wrong, or Oracle does not have the appropriate charset (or whatever) installed to load the locale for AMERICAN_AMERICA.UTF8.

    Also, I consider it rude to cross-post without notifying. Google tells me you crossposted at Stackoverflow.

      I will not reply to your rude answer ! if you have eye, you should see that I'm the owner of that post at stackoverflow !

        "I will not reply to your rude answer !"

        You just did.

        "if you have eye, you should see that I'm the owner of that post at stackoverflow !"

        Corion was already aware of this, it was exactly their point.

Re: Perl to Oracle Connection Error: ERROR OCINlsEnvironmentVariableGet(OCI_NLS_CHARSET_ID)
by mje (Curate) on Dec 16, 2014 at 09:48 UTC
Re: Perl to Oracle Connection Error: ERROR OCINlsEnvironmentVariableGet(OCI_NLS_CHARSET_ID)
by Mr. Muskrat (Canon) on Dec 16, 2014 at 17:11 UTC

    I don't know this is the source of your problem but it looks like you are missing a colon in your DSN. Try adding a colon between Oracle and host.

    BEGIN { $ENV{NLS_LANG} = "AMERICAN_AMERICA.UTF8"; $ENV{OCI_NLS_CHARSET_ID} = "AMERICAN_AMERICA.UTF8"; $ENV{ORACLE_HOME} = #The path to the instant Oracle client"; } #Connect to database my $DBHandle = DBI->connect( "dbi:Oracle:host=$host;sid=$sid;port=$port", $userName, $passWord ) or die "Connection Error: $DBI::errstr\n";
Re: Perl to Oracle Connection Error: ERROR OCINlsEnvironmentVariableGet(OCI_NLS_CHARSET_ID)
by mje (Curate) on Dec 16, 2014 at 09:53 UTC

    What version of instant client did you install. Is it a recent one?

Re: Perl to Oracle Connection Error: ERROR OCINlsEnvironmentVariableGet(OCI_NLS_CHARSET_ID)
by fattahsafa (Sexton) on Dec 16, 2014 at 17:40 UTC
    Hi all, After 2-days investigation I could find the root cause. I used Oracle Instant Client lite 10.2.5 which contains only binaries. Then I tried Oracle Instant Client - SDK, which contains only lib.
    I found I need to merge both to get my code working, I used the SDK as main client, created a bin directory into it then placed the lite client into it...it works !
    Thanks for your gentle replies!
    Abed.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1110461]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2018-10-21 03:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...














    Results (119 votes). Check out past polls.

    Notices?