iis dbi

Discussion in 'Perl' started by John Giblin, Jul 10, 2003.

  1. John Giblin

    John Giblin Guest

    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, Jul 10, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ulloa
    Replies:
    1
    Views:
    530
    Juha Laiho
    Jul 22, 2004
  2. Jerome Hauss
    Replies:
    0
    Views:
    174
    Jerome Hauss
    Oct 13, 2004
  3. John Giblin

    iis and dbi

    John Giblin, Jul 10, 2003, in forum: Perl Misc
    Replies:
    1
    Views:
    84
    Michael Budash
    Jul 10, 2003
  4. Asby

    Mason, DBI, and DBI::Pg

    Asby, Jul 24, 2003, in forum: Perl Misc
    Replies:
    0
    Views:
    178
  5. Tim Haynes
    Replies:
    3
    Views:
    144
    Ron Reidy
    Sep 13, 2003
Loading...

Share This Page