my $dbh; sub connectdb {# connect to database using 3 parameters; return databa +se handle my ($dbstring, $dbdepot, $password) = @_; print "attempt to connect to database $dbstring :$dbdepot\n"; system "time /T"; my $dbhi = DBI->connect($dbstring,$dbdepot,$password, { AutoCommit => 0, RaiseError => 1, PrintError => 1 }) or warn "can't connect to database $dbstring :$dbdepot :", $DB +I::errstr, "\n"; if (defined ($dbhi)) { print "success: $dbhi \n"; return $dbhi; } else { print "Failure\n"; return -1; } } while (($dbh = connectdb($dwqa1,$depot,$pswd) eq -1) && ($sleepcount < + $sleeplimit)) { sleep ($sleepdur); ++$sleepcount; } my $sth = $dbh->prepare("select '$depot', t.table_name, column_name fr +om user_tables t, user_tab_columns c where c.table_name = t.table_nam +e"); $sth->execute();
In reply to DBI: pass $dbh from a sub by poqui
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |