Ronnie has asked for the wisdom of the Perl Monks concerning the following question:
The log file for this contains the "DBI - prepared SQL." entry and the script terminates with the "DBI - Failed to execute SQL (OBFX001S)." message. This message is also correctly present in Email the script sends. Can "command files" be executed from DBI? Thanks in anticipation, Ronnie Cruickshank# ########################################################### # Connect to the DB # ########################################################### # $msg = "\n\tDBI - Failed to connect to $db_name" ; $dbh = DBI->connect( "dbi:Oracle:$db_name", "$username", "$password", +\%attr) or &end_it($mail_msg,$file_open,$to,$domain,$from,$su +bject,$msg,$null,$logfile) ; # ########################################################### # Update logfile # ########################################################### # $msg = "\n\tDBI - User $username connected to $db_name." ; print LOG "$msg" or &end_it($mail_msg,$file_open,$to,$domain,$from,$subject,$msg,$text +,$logfile) ; # ########################################################### # Prepare SQL # ########################################################### # $msg = "\n\tDBI - Preparing SQL." ; print LOG "$msg" or &end_it($mail_msg,$file_open,$to,$domain,$from,$subject,$msg,$text +,$logfile) ; $sth = $dbh->prepare( "\@OBFX001S") or &end_it($mail_msg,$file_open,$to,$domain,$from,$subject,$msg,$nul +l,$logfile) ; # $msg = "\n\tDBI - prepared SQL." ; print LOG "$msg" or &end_it($mail_msg,$file_open,$to,$domain,$from,$subject,$msg,$text +,$logfile) ; # ########################################################### # Execute the prepared SQL # ########################################################### # $msg = "\n\tDBI - Failed to execute SQL (OBFX001S)." ; $sth->execute() or &end_it($mail_msg,$file_open,$to,$domain,$from,$subject,$msg,$null +,$logfile) ; $msg = "\n\tDBI - SQL (\@OBFX001S) executed." ; print LOG "$msg" or &end_it($mail_msg,$file_open,$to,$domain,$from,$subject,$msg,$text +,$logfile) ; # ########################################################### # Disconnect from the DB # ########################################################### # $msg = "\n\tDBI - Failed to disconnect from $db_name." ; $dbh->disconnect() or &end_it($mail_msg,$file_open,$to,$domain,$from,$subject,$msg,$nu +ll,$logfile) ; # ########################################################### #
Edit: Added <code> tags. larsen
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBI & Oracle Command Files
by mpeppler (Vicar) on Aug 19, 2003 at 15:24 UTC | |
by Ronnie (Scribe) on Aug 20, 2003 at 08:56 UTC | |
|
Re: DBI & Oracle Command Files
by dbwiz (Curate) on Aug 19, 2003 at 15:51 UTC | |
|
Re: DBI & Oracle Command Files
by bean (Monk) on Aug 19, 2003 at 17:15 UTC |