If you are going to have to come to us for every error you encounter you are
going to have a very long development cycle.

The "DBI::db=HASH..." is the stringified value in $dbh.

Use $DBI::errstr instead of $dbh->errstr in the die, then you'll get the
error message to tell you what's really wrong.  BTW, even if you had it
outside the quotes, $dbh->errstr won't tell you anything about an error that
is associated with $sth.

Are you using '-w' in the #! line and 'use strict;'?  Both might help you
catch some errors before the get out of hand.
--
Mac :})
** I normally forward private questions to the appropriate mail list. **
Ask Smarter: http://www.tuxedo.org/~esr/faqs/smart-questions.htm
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.
----- Original Message -----
From: "Rick Windham - ISDLIS" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 01, 2002 08:56
Subject: Re: Still having trouble inserting date into Oracle part 2


> > Here is the code snip that I'm using to insert data into Oracle:
> >
> > my $sql = qq{ insert into
apache_load_test(host,ident,authuser,http_date) values (?, ?, ?,
> > to_date(?,'dd/mon
> > /yyyy:hh:mi:ss')) };
> > my $sth = $dbh->prepare ( $sql );
> > if (!$dbh)
> > {
> >        print "error connecting; $DBI::errstr\n";
> > }
> > else
> > {
> >     open (EP,"/accounts/rickw/Dec2001access_log");
> >     #open (EP,"/u01/ias/ias10201/Apache/Apache/logs/Dec2001access_log");
> >     while (<EP>)
> >     {
> >         chomp;
> >         s/\[//g;
> >         s/\]//g;
> >         s/"//g;
> >         my @values = split (/ /,$_);
> >         print "ip address $values[0]  $values[1] $values[2]
$values[3]\n";
> >         $sth->execute($values[0], $values[1], $values[2], $values[3]) ||
die ("didn't insert
> > $dbh->errstr\n")
> > ;
> >         $dbh->commit;
> >
> > I receive this error:
> >
>
> didn't insert DBI::db=HASH(0x1d1990)->errstr
> Database handle destroyed without explicit disconnect, <EP> line 1.



Reply via email to