Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Perl to Oracle Connection Error: ERROR OCINlsEnvironmentVariableGet(OCI_NLS_CHARSET_ID)

by fattahsafa (Sexton)
on Dec 16, 2014 at 08:21 UTC ( [id://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

Replies are listed 'Best First'.
Re: Perl to Oracle Connection Error: ERROR OCINlsEnvironmentVariableGet(OCI_NLS_CHARSET_ID)
by Corion (Patriarch) 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.

    A reply falls below the community's threshold of quality. You may see it by logging in.
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
Domain Nodelet?
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?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2024-03-28 08:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found