Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > iis and dbi

Reply
Thread Tools

iis and dbi

 
 
John Giblin
Guest
Posts: n/a
 
      07-10-2003
Hi,

I am making a simple program that connects to Oracle and then display the
results. When I exec the program via command like, there does not seem to
be a problem. When I do it through a browser I do not get any print commands
past the connection

here is what I have:
use strict;
use DBI;

my ($dbh, $sth, @row);
my %attr = (
PrintError => 0,
RaiseError => 0,
);
$ENV{"ORACLE_HOME"}="F:/oracle/ora92";


print "Content-type:text/html\n\n";
print <<HEADER;
<HTML>
<HEAD>
<TITLE>A Test Page</TITLE>
</HEAD>
<BODY BGCOLOR ="#FFFFFF" TEXT="#000000">
<P>
HEADER


print "Connecting to DB..<br>\n";
$dbh = DBI->connect( 'dbi:Oracle:Mysid','SYSTEM','pawel', \%attr)
or die "Can't connect to database: $DBI::errstr\n";
print "Connected<br>\n";
print "Create sql statement<br>\n";


$sth = $dbh->prepare( "SELECT * FROM Scott.dept" )
or die "Can't prepare SQL statement: $DBI::errstr\n";

print "Exec sql statement<br>\n";

$sth->execute
or die "Can't execute SQL statement: $DBI::errstr\n";

### Retrieve the returned rows of data
while ( my @row = $sth->fetchrow_array() ) {
print "Row: @row\n";
}

warn "Data fetching terminated early by error: $DBI::errstr\n"
if $DBI::err;


$dbh->disconnect();

Results in a browser:
Connecting to DB..





 
Reply With Quote
 
 
 
 
Michael Budash
Guest
Posts: n/a
 
      07-10-2003
In article <YyhPa.24090$(E-Mail Removed)>,
"John Giblin" <(E-Mail Removed)> wrote:

> Hi,
>
> I am making a simple program that connects to Oracle and then display the
> results. When I exec the program via command like, there does not seem to
> be a problem. When I do it through a browser I do not get any print commands
> past the connection
>
> here is what I have:
> use strict;
> use DBI;
>
> my ($dbh, $sth, @row);
> my %attr = (
> PrintError => 0,
> RaiseError => 0,
> );
> $ENV{"ORACLE_HOME"}="F:/oracle/ora92";
>
>
> print "Content-type:text/html\n\n";
> print <<HEADER;
> <HTML>
> <HEAD>
> <TITLE>A Test Page</TITLE>
> </HEAD>
> <BODY BGCOLOR ="#FFFFFF" TEXT="#000000">
> <P>
> HEADER
>
>
> print "Connecting to DB..<br>\n";
> $dbh = DBI->connect( 'dbi:Oracle:Mysid','SYSTEM','pawel', \%attr)
> or die "Can't connect to database: $DBI::errstr\n";
> print "Connected<br>\n";
> print "Create sql statement<br>\n";
>
>
> $sth = $dbh->prepare( "SELECT * FROM Scott.dept" )
> or die "Can't prepare SQL statement: $DBI::errstr\n";
>
> print "Exec sql statement<br>\n";
>
> $sth->execute
> or die "Can't execute SQL statement: $DBI::errstr\n";
>
> ### Retrieve the returned rows of data
> while ( my @row = $sth->fetchrow_array() ) {
> print "Row: @row\n";
> }
>
> warn "Data fetching terminated early by error: $DBI::errstr\n"
> if $DBI::err;
>
>
> $dbh->disconnect();
>
> Results in a browser:
> Connecting to DB..


try:

use strict;
use DBI;
use CGI::Carp qw/fatalsToBrowser/;

my ($dbh, $sth, @row);
my %attr = (
PrintError => 1,
RaiseError => 1,
);

etc.

hth
--
Michael Budash
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DBI Mysql storing DBI:binary, trouble with character 26 Jerome Hauss Ruby 0 10-13-2004 03:04 PM
DBI and DBI::Oracle packages configuration ulloa Perl 1 07-22-2004 05:52 PM
DBI problem : How can I load quickly one huge table with DBI ??. Tim Haynes Perl Misc 3 09-13-2003 03:43 AM
Mason, DBI, and DBI::Pg Asby Perl Misc 0 07-24-2003 09:04 PM
iis dbi John Giblin Perl 0 07-10-2003 05:40 PM



Advertisments