Hey all,
I'm trying to parse the output from the get_dbsize_info procedure with
a Perl script, using the DBI and the DB2 DBD. Below is the relevant
part of the code:
my $dbsql = "call get_dbsize_info(?,?,?,?)";
my $dbsqlh = $dbh->prepare($dbsql);
$dbsqlh->bind_param_inout(1,\$snapshottimestamp,20,{db2_param_type=>SQL_PARAM_OUTPUT});
$dbsqlh->bind_param_inout(2,\$databasesize,20,{db2_param_type=>SQL_PARAM_OUTPUT});
$dbsqlh->bind_param_inout(3,\$databasecapacity,20,{db2_param_type=>SQL_PARAM_OUTPUT});
$dbsqlh->bind_param(4,-1);
$dbsqlh->execute();
The bind_param_inout steps fail with:
DBD::DB2::st bind_param_inout failed: [IBM][CLI Driver] CLI0144E
Invalid parameter type. SQLSTATE=HY105
Not being a developer, I don't have the complete understanding of this.
However, from what I've read, SQL_PARAM_OUTPUT should be valid.
Anyone know what I'm doing wrong?
thanks,
/T
Darin McBride - 23 Aug 2006 00:17 GMT
> Hey all,
>
[quoted text clipped - 5 lines]
> my $dbsqlh = $dbh->prepare($dbsql);
> $dbsqlh->bind_param_inout(1,\$snapshottimestamp,20
{db2_param_type=>SQL_PARAM_OUTPUT});
> $dbsqlh->bind_param_inout(2,\$databasesize,20
{db2_param_type=>SQL_PARAM_OUTPUT});
> $dbsqlh->bind_param_inout(3,\$databasecapacity,20
{db2_param_type=>SQL_PARAM_OUTPUT});
> $dbsqlh->bind_param(4,-1);
> $dbsqlh->execute();
[quoted text clipped - 8 lines]
>
> Anyone know what I'm doing wrong?
I'm not entirely sure, no. But I can make a couple of suggestions.
First, I'm not sure if you are using strict. If not, do so.
Second, you may need to also "use DBD::DB2::Constants;" in your current
namespace.
Of course, you may already be doing both of these, but just didn't put them
in your snippet.
Tomas - 23 Aug 2006 00:34 GMT
Constants! Brilliant! That did the trick. I did use strict, but I
didn't think to use Constants.
Thanks!
/T
> > Hey all,
> >
[quoted text clipped - 32 lines]
> Of course, you may already be doing both of these, but just didn't put them
> in your snippet.