Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
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:
...I get those 'informed' looking responses.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'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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl/Oracle/Newbie Connect Problem
by moritz (Cardinal) on Apr 05, 2010 at 20:58 UTC | |
|
Re: Perl/Oracle/Newbie Connect Problem
by Mr. Muskrat (Canon) on Apr 06, 2010 at 17:14 UTC |