I just took a Perl class and now I'm attempting to expand into database as well. I'm using ActiveState Perl 5.10.1. It comes with DBI and DBD::Oracle. I believe that I know they are installed for sure because when I run:

perl -e "use DBI; print $DBI::VERSION,"\n"; 1.609SCALAR(0x249d74) perl -e "use DBD::Oracle; print DBD::Oracle::VERSION,"\n";" 1.21SCALAR(0x249ef4)
...I get those 'informed' looking responses.

I'm attempting to connect against a remote Oracle 10.2 database with a 10.2 client. I am capable of connecting to it via sqlplus:

C:\Projects\NDC MAC File Load>sqlplus SQL*Plus: Release 10.2.0.3.0 - Production on Fri Apr 2 17:13:45 2010

I've tried several different connection techniques from man pages and google over the past 2 days and nothing seems to work. I always get this basic result:

C:\Projects\NDC MAC File Load>Monk_DBTest.pl DBI connect('host=xx.xx.xx.x;sid=MySID; port=1521','MyUser',...) failed: ERROR OCINlsEnvironmentVariableGet(OCI_NLS_CHARSET_ID) Check ORACLE_HOME and NLS settings etc. at C:\Projects\NDC MAC File Load\Monk_DBTest.pl line 8 Database connection not made: ERROR OCINlsEnvironmentVariableGet(OCI_NLS_CHARSET_ID) Check ORACLE_HOME and NLS settings etc. at C:\Projects\NDC MAC File Load\Monk_DBTest.pl line 8.

Here is the code that generated the above message (...of course the 'real' real code also has real host/User/Pass/SID):

#!/usr/bin/perl use warnings; use DBI; use strict; my $user = 'MyUser; my $passwd = 'MyPass'; my $dbh = DBI->connect("dbi:Oracle:host=xx.xx.xx.x;sid=MySID; port=1521", $user, $passwd) || die "Database connection not made: $DBI::errstr"; $dbh->disconnect;

It seems to want access to some Oracle system variables that it can't find. But, those don't exist in this version of Oracle client for Windows. Rather they are located in the Windows registry. Surely Perl, Oracle, and Windows XP can get along by now - so, it must be me. Where am I going wrong here?


In reply to Perl/Oracle/Newbie Connect Problem by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.