in reply to Re: DBD::DB2::st execute failed: Bind failed
in thread DBD::DB2::st execute failed: Bind failed

I'm using the query

select session_id, ctime, atime, data from schema.session where sessio +n_id = ?
and the describe table shows
Column Type Type name schema name Length Scale Nulls --------------- --------- ------------------ -------- ----- ------ SESSION_ID SYSIBM CHARACTER 40 0 No CTIME SYSIBM INTEGER 4 0 Yes ATIME SYSIBM INTEGER 4 0 Yes DATA SYSIBM VARCHAR 1024 0 Yes
It's pretty straightforward.

Alex / talexb / Toronto

Team website: Forex Chart Monkey, Forex Technical Analysis and Pickpocket Prevention

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Replies are listed 'Best First'.
Re^3: DBD::DB2::st execute failed: Bind failed
by mje (Curate) on Feb 18, 2010 at 17:59 UTC

    To debug why not call bind_param(1, $session_id) yourself and omit it from execute (I don't really understand why you don't get a better error and this might help). I'd also try taking one chr off the end of the session_id as your ids are exactly 40 chrs and so is the field (so nothing wrong but try it).

Re^3: DBD::DB2::st execute failed: Bind failed
by kennethk (Abbot) on Feb 18, 2010 at 18:05 UTC
    I certainly agree that there are no red flags in what you've posted. What happens when you sub the following for your execute command:

    my $sth = $self->{sth_get}; $sth->bind_param(1, $session_id) or die "Bind failure:" . $sth->errstr +; $sth->execute() or die "Execute failure:" . $sth->errstr;

    I'm also a little curious why the binding failure dies in the DBD code as opposed to bubbling up to the user as a simple execute failure. Not so curious as to go source diving, but still...