On Mon, 21 Feb 2005 16:14:43 -0500, Jason Wozniak <[EMAIL PROTECTED]> wrote: > That's what I thought, but it doesn't work, which is why I tried system. > > The below code: > > use DBI; > > my $database; > #my $address = "[EMAIL PROTECTED]"; > my $address = "[EMAIL PROTECTED]"; > my %attr; > my $dbh; > open MAIL, "|mail $address"; > open DBFILE, "</u01/app/oracle/check_list.txt"; > > while (<DBFILE>) { > $ENV{ORACLE_SID} == chomp($_); > print "$ENV{ORACLE_SID}\n"; > $dbh = DBI->connect( "dbi:Oracle:$database", "", "", \%attr) > or print MAIL "Could not connect to database: $ENV{ORACLE_SID} > $DBI::errstr\n"; > } > close MAIL; > > produces the following output: > > P01 > P01 > P01 > P01 > P01 > > The file /u01/app/oracle/check_list.txt contains several different sids, > and if I print $_ it is reading them in. >
Jason, I'm not sure about this, but it seems to me that ORACLE_SID is probably set by some system process after you log into the database, and can't be reset by the user. Have you tried resetting from the shell using export (or whatever command is appropriate for your shell)? Allowing what you're trying to do--a combination of passwordless login and masquerading as multiple users--would be a very insecure. I certainly wouldn't want my data stored anywhere you could get away with this. That said, try actually assigning the variable in the loop. "==" is a test for numerical equality. "=" is for variable assignment. Turn on use strict and use warnings to help you clean up your code; you may find there aren't as many problems as you think there are. On the other hand, the shell has read only variables; this may be one of them. Getting this to work may require writing the script to run as root (or the oracle user) using Perl::IPC or similar to manipulate the tty/pty info. You'll probably have to feed it passwords at some point, though. A server that just takes your word for your user id is a server you want to steer very clear of. --jay -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>