Go Back   Velocity Reviews > Newsgroups > PERL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

PERL - iis dbi

 
Thread Tools Search this Thread
Old 07-10-2003, 06:40 PM   #1
Default iis dbi


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..







John Giblin
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump