Hello, I've have a problem with connecting to an Oracle database using DBI under Unix. Basically, I have the Database user passwords in a unix flat file, which I read into the perl script setting a local variable. The Oracle database name and the User name a passed to the perl script as arguements. When I try to connect to the database I get the Oracle invalid user/password error. I have investigated this and know that the Database name and User name are being picked up correctly, but for some reason the DBI module is ignoring the contents of the password variable, even though it is set correctly. Now, if I reset the password variable (ie: hard code the password into the perl script) just before I try connecting to the database it works!! If anybody has any Ideas, I would be most grateful. Below is the code I am using: Many thanks. David ---------------------------------------------------------------------- #!/usr/local/bin/perl -w ########################################## # Include DBI ########################################## eval '$dbh::safe = 1' if $] >=5; eval 'use DBI; 1' || die $@ if $] >=5; #################################################################### #Check that three arguements have been passed and set variables #################################################################### if (scalar(@ARGV) != 3) { print "ERROR: Incorrect number of arguements passed. \n"; print "ERROR: Specify User, SID and PWD file. \n"; exit; } $dbuser = $ARGV[0]; $dbname = $ARGV[1]; $pwd = $ARGV[2]; $dbuser_orig = "$dbuser"; ################################################## # Open/retreive password from flat file ################################################## open(USERPWD,"$pwd") || die "Could not open password file!"; $dbpass = <USERPWD>; close(USERPWD); ###################################################### # Connect/logon to database ###################################################### # $dbh = DBI->connect("dbi:Oracle:$dbname","$dbuser","$dbpass", "") || die "$DBI::$errstr\n "; -----------------------------------------------------------------------
DBI::Oracle problem
David Sherrington - Enterprise Services- Data Management Systems Engineer Wed, 07 Feb 2001 03:38:33 -0800